MCPcopy Create free account
hub / github.com/SimHacker/micropolis / half_swap_longs

Function half_swap_longs

MicropolisCore/src/MicropolisEngine/src/fileio.cpp:113–125  ·  view source on GitHub ↗

* Swap upper and lower words of all longs in the array. * @param buf Array with longs. * @param len Number of long values in the array. */

Source from the content-addressed store, hash-verified

111 * @param len Number of long values in the array.
112 */
113static void half_swap_longs(long *buf, int len)
114{
115 int i;
116
117 /* Flip bytes in each long! */
118 for (i = 0; i < len; i++) {
119 long l = *buf;
120 *buf =
121 ((l & 0x0000ffff) << 16) |
122 ((l & 0xffff0000) >> 16);
123 buf++;
124 }
125}
126
127
128#else

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected