PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
endianSwap.c
1 /*
2  * @file endianSwap.c
3  *
4  * @author Andy Lindsay
5  *
6  * @copyright
7  * Copyright (C) Parallax, Inc. 2014. All Rights MIT Licensed.
8  *
9  * @brief Source code for endianSwap function.
10  */
11 
12 
13 #include "simpletools.h"
14 
15 void endianSwap(void *resultAddr, void *varAddr, int byteCount)
16 {
17  char *varPtr = (char *) varAddr;
18  char *resPtr = (char *) resultAddr;
19  for(int i = 0; i < byteCount; i++)
20  {
21  *(resPtr+i) = *(varPtr + byteCount - 1 - i);
22  }
23 }
24 
25 
endianSwap
void endianSwap(void *resultAddr, void *varAddr, int byteCount)
Take bytes in one variable at varAddr, swap their order, and store them in another variable at result...
Definition: endianSwap.c:15
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...