User:Strife Onizuka/int2hex
< User:Strife Onizuka
Jump to navigation
Jump to search
Revision as of 17:54, 8 November 2009 by Strife Onizuka (talk | contribs)
<lsl> string int2hex(integer I) {//0x prefix version
integer c = llCeil(llLog((I | 15 | (I >> 1)) & 0x7FFFFFFF) / 2.7725887222397812376689284858327) + 1; I = I << ((9 - c) << 2); integer A = (I >> 14) & 0x0003C000; integer B = (I >> 16) & 0x00000F00; integer C = (I >> 18) & 0x0000003C; integer D = (I << 10) & 0x3C000000; integer E = (I << 8) & 0x00F00000; integer F = (I << 6) & 0x0003C000; integer G = (I << 4) & 0x00000F00; integer H = (I << 2) & 0x0000003C; return llGetSubString( llInsertString( llIntegerToBase64( A + B + C + 0xD31D34D3//lowercase-x=0xD31D34D3, uppercase-X=0xD17D34D3 - (0x000F8000 * (A / 0x00028000))//lowercase=0x00090000, uppercase=0x000F8000 - (0x00003E00 * (B / 0x00000A00))//lowercase=0x00002400, uppercase=0x00003E00 - (0x000000F8 * (C / 0x00000028))//lowercase=0x00000090, uppercase=0x000000F8 ), 5, llIntegerToBase64( D + E + F + G + H + 0xD34D34D3 - (0xF8000000 * (D / 0x28000000))//lowercase=0x90000000, uppercase=0xF8000000 - (0x03E00000 * (E / 0x00A00000))//lowercase=0x02400000, uppercase=0x03E00000 - (0x000F8000 * (F / 0x00028000))//lowercase=0x00090000, uppercase=0x000F8000 - (0x00003E00 * (G / 0x00000A00))//lowercase=0x00002400, uppercase=0x00003E00 - (0x000000F8 * (H / 0x00000028))//lowercase=0x00000090, uppercase=0x000000F8 ) ), 0, c );
}
string int2hex(integer I) {//pure hex version
//ABCDEFGH integer A = (I >> 2) & 0x3C000000; integer B = (I >> 4) & 0x00F00000; integer C = (I >> 6) & 0x0003C000; integer D = (I >> 8) & 0x00000F00; integer E = (I << 14) & 0x3C000000; integer F = (I << 12) & 0x00F00000; integer G = (I << 10) & 0x0003C000; integer H = (I << 8) & 0x00000F00; return llGetSubString( llInsertString( llIntegerToBase64( A + B + C + D + 0xD34D3400 - (0xF8000000 * (A / 0x28000000))//lowercase=0x90000000, uppercase=0xF8000000 - (0x03E00000 * (B / 0x00A00000))//lowercase=0x02400000, uppercase=0x03E00000 - (0x000F8000 * (C / 0x00028000))//lowercase=0x00090000, uppercase=0x000F8000 - (0x00003E00 * (D / 0x00000A00))//lowercase=0x00002400, uppercase=0x00003E00 ), 4, llIntegerToBase64( E + F + G + H + 0xD34D3400 - (0xF8000000 * (E / 0x28000000))//lowercase=0x90000000, uppercase=0xF8000000 - (0x03E00000 * (F / 0x00A00000))//lowercase=0x02400000, uppercase=0x03E00000 - (0x000F8000 * (G / 0x00028000))//lowercase=0x00090000, uppercase=0x000F8000 - (0x00003E00 * (H / 0x00000A00))//lowercase=0x00002400, uppercase=0x00003E00 ) ), 8 - llCeil(llLog((I | 15 | (I >> 1)) & 0x7FFFFFFF) / 2.7725887222397812376689284858327), 7 );
} </lsl>