|
|
1.1 root 1: /* netutil.s - hs2net, net2hs, hl2net, net2hl */
2:
3: /*------------------------------------------------------------------------
4: * Utility routines that map host data to/from network byte/word order
5: * (needed because host is "Little Endian", network is "Big Endian")
6: *------------------------------------------------------------------------
7: */
8: .text
9: .align 1
10: .globl _hl2net
11: .globl _net2hl
12: _hl2net: /* Entry point that maps ints,longs */
13: _net2hl: /* to/from host/network byte order */
14: .word 0x0 /* save no registers on entry */
15: movb 7(ap),r0
16: insv 6(ap),$8,$8,r0
17: insv 5(ap),$16,$8,r0
18: insv 4(ap),$24,$8,r0
19: ret
20:
21: .align 1
22: .globl _hs2net
23: .globl _net2hs
24: _hs2net: /* Entry point that maps shorts to/from */
25: _net2hs: /* host/network byte order */
26: .word 0x0 /* save no registers on entry */
27: movb 5(ap),r0 /* swap short argument bytes and return */
28: insv 4(ap),$8,$8,r0
29: cvtwl r0,r0 /* C convention: convert to int */
30: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.