User:Strife Onizuka

From Second Life Wiki
Revision as of 04:45, 29 January 2007 by Strife Onizuka (talk | contribs)
Jump to navigation Jump to search

About Me

I'm an immigrant from URU. Was in all 3 of it's beta's.

Wiki Troll (but a good one, causing drama isn't why i'm here).

I have a webpage but haven't updated it in a few months...

Wiki's are the way of the future when it comes to making documentation Ad-hoc but eventually become static as graffiti grows with popularity as a way of controling it.

also contribute to some other wiki's History Wiki AviSynth:BlindWanderer

When it comes to writing I tend to go towards concise. A short accurate description is better then a long equally accurate description; less to get confused with, easier to find the important information (because it is all important).

Downloads

Updates:Preview Download
[DMZ][Preview]
[Agni][Preview]
[Colo][Preview]
[Siva][Preview]
[Durga][Preview]
[Aditi][Preview]
[Soma][Preview]
[Ganga][Preview]

My Code

<lsl>string TightListDump(list a, string b) {

   string c = (string)a;
   if(llStringLength(b)==1)
       if(llSubStringIndex(c,b) == -1)
           jump end;
   integer d = 1 - llStringLength(b += "|\\/?!@#$%^&*()_=:;~{}[],\n\" qQxXzZ");
   while(1+llSubStringIndex(c,llGetSubString(b,d,d)) && d)
       ++d;
   b = llGetSubString(b,d,d);
   @end;
   c = "";//save memory
   return b + llDumpList2String(a, b);

}

list TightListParse(string a) {

   string b = llGetSubString(a,0,0);//save memory
   return llParseStringKeepNulls(llDeleteSubString(a,0,0), [a=b],[]);

}

list quickread(string a) {

   string c = llGetSubString(a,0,6);
   return llDeleteSubList([a]+//a = llGetSubString(c,0,0) by this point
                       llParseStringKeepNulls(llDeleteSubString(a,0,5), [],[a=llGetSubString(c,0,0),
                       llGetSubString(c,1,1),llGetSubString(c,2,2),llGetSubString(c,3,3),
                       llGetSubString(c,4,4),llGetSubString(c,5,5)]),
                       (llSubStringIndex(c,llGetSubString(c,6,6))==-1),1);

}

integer TightListTypeLength(string a) {

   return llGetListLength(quickread(a))/2;

}

integer TightListTypeEntryType(string a, integer b) {

   string c = llGetSubString(a,0,6);
   a = llList2String(quickread(a),  b * 2);
   return 1 + llSubStringIndex(c, a) - !llStringLength(a);

}

list TightListTypeParse(string a) {

   if(llStringLength(a) < 7)  return [];
   string m = llGetSubString(a,0,6);
   list b = quickread((a = "") + a);
   integer c = -llGetListLength(b);
   list f;
   integer d;
   do
   {
       f = [a = llList2String(b,c + 1)]; //TYPE_STRING || TYPE_INVALID (though we don't care about invalid)
       if((d = (1 + llSubStringIndex(m, llList2String(b,c)))) == TYPE_FLOAT)
           f = [(float)a];
       else if(d == TYPE_VECTOR)
           f = [(vector)a];
       else if(d == TYPE_ROTATION)
           f = [(rotation)a];
       else if(d == TYPE_KEY)
           f = [(key)a];
       else if(d == TYPE_INTEGER)
           f = [(integer)a];
       b = llListReplaceList(b, f, c, c+1);
   }while(0 > (c+=2));
   return b;

}

string TightListTypeDump(list a, string b) {

   b += "|\\/?!@#$%^&*()_=:;~{}[],\n\" qQxXzZ";
   string c = (string)a;
   integer d = 0;
   do
       if(1+llSubStringIndex(c,llGetSubString(b,d,d)))
           b = llDeleteSubString(b,d,d);
       else
           ++d;
   while(d<6);
   b = " " + c = llGetSubString(b,0,5);
   integer e;
   string f;
   if((d = -llGetListLength(a)))
   {
       do
       {
           e = llGetListEntryType(a,d);
           if(e == TYPE_VECTOR)
               f = vec(llList2Vector(a,d));
           else if(e == TYPE_ROTATION)
               f = rot(llList2Rot(a,d));
           else if(e == TYPE_FLOAT)
               f = flo(llList2Float(a,d));
           else
               f = llList2String(a,d);
           c+= llGetSubString(b,e,e) + f;
       }while(++d);
   }
   return c;

}</lsl>


<lsl>integer fui(float a) {//union float to integer

   integer b = (a<0) << 31;
   if(a)
   {
       if((a = llFabs(a)) < 1.1754943508222875079687365372222e-38)
           return b | (integer)(a / 1.4012984643248170709237295832896e-45);
       integer c = llFloor(llLog(a) / 0.69314718055994530941723212145818);
       if(c > 127){c = 127;}
       if((a /= (float)("0x1p"+(string)c)) < 1){a*=2; --c;}
       return ((c + 127) << 23 ) | (integer)((a - 1) * 8388608.0) | b;
   }
   return ((string)a == (string)(-0.0)) << 31;

}

float iuf(integer a) {//union integer to float

   integer c= (a >> 23) & 0xff;
   float b = (a & 0x7fffff) * 1.1920928955078125e-7;
   if(c == 0xff)
       b = 1 / 0; //NaN or Infinity (since getting them crashes the script, thats we do).
   else if(c)
       b = (b + 1) * (float)("0x1p"+(string)(c - 127));
   else
       b = b * 1.1754943508222875079687365372222e-38;
   return b * ((a >> 31) | 1);

}

string hexc="0123456789ABCDEF";

string int6hex(integer x) {

   integer x0 = 0;
   string res = "";
   integer c = 26;
   do res += llGetSubString(hexc,x0 = (x >> c-=4) & 0xf , x0); while(c); 
   return res;

}

float iuf_alt(integer a) {//union integer to float

   integer c = (a >> 23) & 0xff;
   float b;
   if(c == 0xff)
       b = 1 / 0; //NaN or Infinity (since getting them crashes the script, thats we do).
   else if(c)
       b = (float)("0x1."+int6hex(a << 1)+"p"+(string)(c - 127));
   else
       b = (a & 0x7fffff) * 1.4012984643248170709237295832896e-45;
   return b * ((a >> 31) | 1);

}</lsl>

<lsl>integer FloatCompare(float a, float b, integer c) {//compare floats and allow for a margin of error, requires fui().

   if(a - b)//(c) Strife Onizuka 2006 
   {//they are not equal
       //First we convert the floats to integer form, as they would be in memory;
       integer a_i = fui(a);
       integer b_i = fui(b);
       integer a_e = (a_i >> 23) & 0xff;
       integer b_e = (b_i >> 23) & 0xff;
       if(!(a_e || b_e) || //to disable the +/- roll under support put a // just before the !
           ((a_i & 0x80000000) == (b_i & 0x80000000)))//sign match check
       {//start by getting and testing the difference, this is what limits c
           integer diff = a_e - b_e;//ugly is fast, basicly, it gets the mantissa, sets the sign on the mantisa,
           if(diff >= -1 || diff <= 1)//shifts it depending on exponent, finaly executes the test.
               if(llAbs(((((a_i & 0x7FFFFF) | (!!a_e << 23)) * ((a_i >> 31) | 1)) >> !~-diff) - 
                        ((((b_i & 0x7FFFFF) | (!!b_e << 23)) * ((b_i >> 31) | 1)) >> !~diff)) <= c)
                   jump out;
       }
       return (a > b) - (a < b);
   }
   @out;
   return 0;

}</lsl>

<lsl>integer bitcount(integer n) {//MIT Hackmem 169, modified to work in LSL

   integer tmp = n - ((n >> 1) & 0x5B6DB6DB)//modified mask
                   - ((n >> 2) & 0x49249249);
   return (((tmp + (tmp >> 3)) & 0xC71C71C7) % 63) + (n < 0);

}</lsl>