On 12 Mar 2015 22:25, Jiri Gaisler wrote: > On 02/03/15 02:13, Mike Frysinger wrote: > >> +#ifdef HOST_LITTLE_ENDIAN > >> > + for (i = 0; i < (count / 4); i++) wbuffer[i] = ntohl(wbuffer[i]); // endian swap > >> > +#endif > > > > sim-endian.h already provides a lot of helper funcs that i'm pretty sure you > > can use here. > > I don't understand why ntohl() is a problem. It is a common Posix function > that converts big endian to host endian, exactly what is needed. Using > sim-endian.h pulls in a lot of the sim-*.c files due to dependencies and > makes the simulator larger than necessary .... "network" has no meaning here. using it as a proxy for moving between big endian and native endian when there are clear functions that the sim has standardized on isn't correct. your code also (1) requires duplicating branches and (2) inline preprocessor checks. it also does not properly handle bi-endian builds. sim-endian does all of these for you. the whole point of common/ is to delete code from each sim rather than open coding it everywhere. wrt size, i don't think that's a compelling argument. we're talking units of KiB here, and i can't even count that low :P. if you're having trouble converting the build over (compiling/linking errors), then we can discuss that. but it'd be a matter of "do we do it now or later" rather than "do we do ever convert". -mike