Hi, Certainly, including winsock2.h just to define ntoh() is an extreme overkill! Your proposal sounds very sensible to me. Regarding the names, I also prefer the shorter version, since ntoh() is well known enough, but this is very arguable so I won't argue about it.
If this is finally accepted, I suggest you submit it through Phab and undergo the regular review process :P Xavi On Tue, 18 Dec 2018 at 15:00, Vincent Torri <[email protected]> wrote: > Hello > > i would like to introduce in eina (more precisely in eina_cpu) > implementations of ntohl and al. The reason is: on Windows, it > requires to link against winsock2 and include winsock2.h, with > introduce compilation errors with libjpeg in Emile (they both redefine > the same types, with different definition (bool is an int or a char, > etc...) > > On unix, it requires also network header files. > > so a solution would be to redefine ntohl in eina, using eina_swap* > ntohl and al. are not critical functions. I also looked at the asm > code generated by gcc with optimizations and it uses bswap, so the > functions are well optimized. > > it would also reduce non cross platform code (inclusion of winsock2.h > or netinet/in.h or arpa/inet.h, no more -lws2_32 link (and even better > : no more dynamic link with ws2_32.dll in non-network files)) > > I've attached the source code. I would like your opinion about the names. > > raster proposed eina_swap_from_bigendian_*() > i would prefer eina_ntoh*() : it's a smaller name, the functions are well > known > > thank you > > Vincent > _______________________________________________ > enlightenment-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
