902aa402b3830b9c9aa26758390b6eb93b42a0f5
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

1) /* MIPS I system
Stefan Schuermans replace email address in he...

Stefan Schuermans authored 12 years ago

2)  * Copyright 2011-2012 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

3)  * Copyleft GNU public license V2 or later
4)  *          http://www.gnu.org/copyleft/gpl.html
5)  */
6) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

7) #ifndef NETHELP_H
8) #define NETHELP_H
9) 
10) // byte order
11) #define ntohs(n) (((unsigned short)(n) & 0xFF00) >> 8 | \
12)                   ((unsigned short)(n) & 0x00FF) << 8)
13) #define htons(h) (((unsigned short)(h) & 0xFF00) >> 8 | \
14)                   ((unsigned short)(h) & 0x00FF) << 8)
Stefan Schuermans switch to long tpye for ntohl

Stefan Schuermans authored 12 years ago

15) #define ntohl(n) (((unsigned long)(n) & 0xFF000000) >> 24 | \
16)                   ((unsigned long)(n) & 0x00FF0000) >> 8 | \
17)                   ((unsigned long)(n) & 0x0000FF00) << 8 | \
18)                   ((unsigned long)(n) & 0x000000FF) << 24)
19) #define htonl(h) (((unsigned long)(h) & 0xFF000000) >> 24 | \
20)                   ((unsigned long)(h) & 0x00FF0000) >> 8 | \
21)                   ((unsigned long)(h) & 0x0000FF00) << 8 | \
22)                   ((unsigned long)(h) & 0x000000FF) << 24)