152710Sbostic/*- 252710Sbostic * Copyright (c) 1991 The Regents of the University of California. 352710Sbostic * All rights reserved. 452710Sbostic * 552710Sbostic * This code is derived from software contributed to Berkeley by 652710Sbostic * Ralph Campbell. 752710Sbostic * 852710Sbostic * %sccs.include.redist.c% 952710Sbostic */ 1052710Sbostic 11*52738Sbostic#include "DEFS.h" 12*52738Sbostic 1352710Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*52738Sbostic ASMSTR("@(#)htonl.s 5.2 (Berkeley) 02/29/92") 1552710Sbostic#endif /* LIBC_SCCS and not lint */ 1652710Sbostic 1752710Sbostic/* 1852710Sbostic * netorder = htonl(hostorder) 1952710Sbostic * hostorder = ntohl(netorder) 2052710Sbostic */ 2152710SbosticLEAF(htonl) # a0 = 0x11223344, return 0x44332211 2252710SbosticALEAF(ntohl) 2352710Sbostic srl v1, a0, 24 # v1 = 0x00000011 2452710Sbostic sll v0, a0, 24 # v0 = 0x44000000 2552710Sbostic or v0, v0, v1 2652710Sbostic and v1, a0, 0xff00 2752710Sbostic sll v1, v1, 8 # v1 = 0x00330000 2852710Sbostic or v0, v0, v1 2952710Sbostic srl v1, a0, 8 3052710Sbostic and v1, v1, 0xff00 # v1 = 0x00002200 3152710Sbostic or v0, v0, v1 3252710Sbostic j ra 3352710SbosticEND(htonl) 34