152710Sbostic/*- 2*61143Sbostic * Copyright (c) 1991, 1993 3*61143Sbostic * The Regents of the University of California. 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 1155706Sralph#include <machine/machAsmDefs.h> 1252738Sbostic 1352710Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*61143Sbostic ASMSTR("@(#)htonl.s 8.1 (Berkeley) 06/04/93") 1552710Sbostic#endif /* LIBC_SCCS and not lint */ 1652710Sbostic 1752710Sbostic/* 1852710Sbostic * netorder = htonl(hostorder) 1952710Sbostic * hostorder = ntohl(netorder) 2052710Sbostic */ 2158126SralphNLEAF(htonl) # a0 = 0x11223344, return 0x44332211 2252710SbosticALEAF(ntohl) 2358126Sralph#ifdef MIPSEL 2452710Sbostic srl v1, a0, 24 # v1 = 0x00000011 2552710Sbostic sll v0, a0, 24 # v0 = 0x44000000 2652710Sbostic or v0, v0, v1 2752710Sbostic and v1, a0, 0xff00 2852710Sbostic sll v1, v1, 8 # v1 = 0x00330000 2952710Sbostic or v0, v0, v1 3052710Sbostic srl v1, a0, 8 3152710Sbostic and v1, v1, 0xff00 # v1 = 0x00002200 3252710Sbostic or v0, v0, v1 3354153Sralph#else 3458126Sralph#ifdef MIPSEB 3554153Sralph move v0, a0 3654153Sralph#else 3754153Sralph ERROR 3854153Sralph#endif 3954153Sralph#endif 4052710Sbostic j ra 4152710SbosticEND(htonl) 42