Add fart.hton module

This commit is contained in:
josh committed 2023-10-09 19:13:11 -04:00
1 parent 42e2508766
commit 5b449506cb
1 file changed
+35
+35
View File
@@ -0,0 +1,35 @@
/**
* @file
*
* Host to network byte-swapping functions.
*/
module fart.hton;
version (BigEndian)
{
public uint htonl(uint v)
{
return v;
}
public uint ntohl(uint v)
{
return v;
}
}
version (LittleEndian)
{
import core.bitop;
public uint htonl(uint v)
{
return bswap(v);
}
public uint ntohl(uint v)
{
return bswap(v);
}
}