User | Post |
elixirnova
Posts: 36/177 |
ah all fixed seamed i needed to learn two new operators modulus and int works fine now thanks everyone |
Dish
Posts: 120/596 |
If you're using VB you shouldn't have to worry about this at all... since VB will only run on Windows (a little endian system), if you save a multi-byte variable to a file, it will automatically write it as little endian. You'd only have to do any kind of swapping if you want to write it as big endian. |
neotransotaku
Posts: 1313/4016 |
can't you just write back, 55 as the first byte and then 01 as the next byte to write back? as long as you write to file using bytes, then everything should be fine. |
Monsty
Posts: 6/6 |
SwitchEnd = ((Number And &HFF) * &H100) And (Number \ &H100)
That value should switch the endian-ness of any two-byte number...I think. Didn't test.
EDIT: D'oh, now I know why you ignored me. I put one wrong operator! Sure, you say it's all good now...but I needed to fix this, so here we go:
SwitchEnd = ((Number And &HFF) * &H100) Or (Number \ &H100)
Notice the And switch to Or? Yeah, that should fix it. Plus it should be mucho faster than anything involving modulus(if you have to do it a lot, anyways). |
elixirnova
Posts: 34/177 |
hey im using little endian to store my level data ex 55 01 or ad 00 or fe 02 so i used let byte2 = 01 and byte1 = 55 as in the example (Byte2 * &H100) + Byte 1 so using that equation used the result is 155 and i cant figure out how i am to convert it back to 55 01 for saving purposes O_o any help im using VB.net |