Valhalla Legends Archive

Programming => General Programming => Topic started by: Nub_1 on November 20, 2003, 08:32 PM

Title: Copy Memory
Post by: Nub_1 on November 20, 2003, 08:32 PM
I'v been seeing the CopyMemory() a lot resently in source code, and I don't understand exactly what it's point is. can anyone tell me what exactly the point of CopyMemory is?
Title: Re:Copy Memory
Post by: Banana fanna fo fanna on November 20, 2003, 08:44 PM
Battle.net's binary interface uses little-endian numbers, and so does Intel's CPU. By copying the representation of the integer into a buffer, you effectively get it in little-endian with no work.
Title: Re:Copy Memory
Post by: Nub_1 on November 20, 2003, 09:01 PM
Little-endian numbers? what are those?
Title: Re:Copy Memory
Post by: iago on November 20, 2003, 09:57 PM
1, in four bytes, looks like this:
Little-endian:
01 00 00 00
Big-endian
00 00 00 01

256 (0x100) in 4 bytes
Little-endian
00 01 00 00
Big-endian
00 00 01 00

123456 (0x1e240) in 4 bytes:
Little-endian:
40 e2 01 00
Bit-endian:
00 01 e2 40


There's good reasons for using little-endian, even though it's counter-intuitive, but they are irrelevant here.

Copy memory is just what it says, it copies memory from one place to another.