1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ralph Campbell. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11#include <machine/machAsmDefs.h> 12 13#if defined(LIBC_SCCS) && !defined(lint) 14 ASMSTR("@(#)htons.s 8.1 (Berkeley) 06/04/93") 15#endif /* LIBC_SCCS and not lint */ 16 17/* 18 * netorder = htons(hostorder) 19 * hostorder = ntohs(netorder) 20 */ 21NLEAF(htons) 22ALEAF(ntohs) 23#ifdef MIPSEL 24 srl v0, a0, 8 25 and v0, v0, 0xff 26 sll v1, a0, 8 27 and v1, v1, 0xff00 28 or v0, v0, v1 29#else 30#ifdef MIPSEB 31 move v0, a0 32#else 33 ERROR 34#endif 35#endif 36 j ra 37END(htons) 38