logic-analyzer
All Classes Functions Pages
network.h
1 #pragma once
10 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11 
12 #define htons(x) x
13 #define ntohs(x) x
14 #define htonl(x) x
15 #define ntohl(x) x
16 
17 #else
18 // The Pico is little endian !
19 #define IS_LITTLE_ENDIAN
20 #define htons(x) ( ((x)<< 8 & 0xFF00) | ((x)>> 8 & 0x00FF) )
21 #define ntohs(x) htons(x)
22 #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | ((x)<< 8 & 0x00FF0000UL) | ((x)>> 8 & 0x0000FF00UL) | ((x)>>24 & 0x000000FFUL) )
23 #define ntohl(x) htonl(x)
24 
25 #endif