Difference between revisions of "Talk:BTLT"
Jump to navigation
Jump to search
(Info on bug in the vector conversion functions.) |
(→A bug in stiufv/vfuist: Realized that there was one little grub hiding from me...) |
||
Line 9: | Line 9: | ||
integer offset = 1; | integer offset = 1; | ||
integer len = raw & 7; | integer len = raw & 7; | ||
return <stiuf(llDeleteSubString(in, | return <stiuf(llDeleteSubString(in, len + 2, 1)), | ||
stiuf(llDeleteSubString(in, (len = (7 & (raw >> 3))) - ~(offset += len), offset)), | stiuf(llDeleteSubString(in, (len = (7 & (raw >> 3))) - ~(offset += len), offset)), | ||
stiuf(llDeleteSubString(in, 0, offset + len)) >; | stiuf(llDeleteSubString(in, 0, offset + len)) >; |
Revision as of 22:02, 4 November 2007
A bug in stiufv/vfuist
I was trying to use BTLT in one of my projects, and I kept noticing that the vectors were not coming beck out correctly, so I built a simple test script to demo what I thought I was observing, and sure enough, the first value in every vector I gave BTLT came back out incorrect. So, after some sniffing around the code, I came up with this fix:
Code: BTLT stiufv/vfuist fix |
vector stiufv(string in) { //-XXXXYYYYZZZZ integer raw = llBase64ToInteger(llGetSubString("AAA" + in + "AAAAAA", 0, 5)) >> 2; integer offset = 1; integer len = raw & 7; return <stiuf(llDeleteSubString(in, len + 2, 1)), stiuf(llDeleteSubString(in, (len = (7 & (raw >> 3))) - ~(offset += len), offset)), stiuf(llDeleteSubString(in, 0, offset + len)) >; } string vfuist(vector in) { string buf = fuist(in.y); integer len = llStringLength(buf); return llGetSubString(llIntegerToBase64(((len << 3) | llStringLength(buf)) << 2), 3, 4) + (buf = fuist(in.x)) + buf + fuist(in.z); } //-XXXXYYYYZZZZ |
I can't say that I understood all the code, I am still not up to the level of understanding code this optimized... But I compared these vector functions to the (working) rotation functions to come up with this fix, and found that it seems to work! Cron Stardust 21:06, 4 November 2007 (PST)