MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / sethtons

Function sethtons

GPRS/ByteVector.cpp:28–33  ·  view source on GitHub ↗

Set the char[2] array at ip to a 16-bit int value, swizzling bytes as needed for network order.

Source from the content-addressed store, hash-verified

26
27// Set the char[2] array at ip to a 16-bit int value, swizzling bytes as needed for network order.
28void sethtons(ByteType *cp,unsigned value)
29{
30 uint16_t tmp = htons(value);
31 ByteType *tp = (ByteType*)&tmp;
32 cp[0]=tp[0]; cp[1]=tp[1]; // Overkill but safe.
33}
34
35// Set the char[4] array at ip to a 32-bit int value, swizzling bytes as needed for network order.
36void sethtonl(ByteType *cp,unsigned value)

Callers 1

setUInt16Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected