124da5b34Srie /* 224da5b34Srie * CDDL HEADER START 324da5b34Srie * 424da5b34Srie * The contents of this file are subject to the terms of the 524da5b34Srie * Common Development and Distribution License (the "License"). 624da5b34Srie * You may not use this file except in compliance with the License. 724da5b34Srie * 824da5b34Srie * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 924da5b34Srie * or http://www.opensolaris.org/os/licensing. 1024da5b34Srie * See the License for the specific language governing permissions 1124da5b34Srie * and limitations under the License. 1224da5b34Srie * 1324da5b34Srie * When distributing Covered Code, include this CDDL HEADER in each 1424da5b34Srie * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1524da5b34Srie * If applicable, add the following below this CDDL HEADER, with the 1624da5b34Srie * fields enclosed by brackets "[]" replaced with your own identifying 1724da5b34Srie * information: Portions Copyright [yyyy] [name of copyright owner] 1824da5b34Srie * 1924da5b34Srie * CDDL HEADER END 2024da5b34Srie */ 2124da5b34Srie 2224da5b34Srie /* 23*4b56a003SDaniel Anderson * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2424da5b34Srie * Use is subject to license terms. 2524da5b34Srie */ 2624da5b34Srie 2724da5b34Srie #include <sys/isa_defs.h> 2824da5b34Srie #include <sys/types.h> 2924da5b34Srie 3024da5b34Srie 3124da5b34Srie #if defined(_LITTLE_ENDIAN) && !defined(__lint) 3224da5b34Srie 3324da5b34Srie #error Use ISA-specific byteorder.s on a little-endian machine. 3424da5b34Srie 3524da5b34Srie #else /* !_LITTLE_ENDIAN */ 3624da5b34Srie 37*4b56a003SDaniel Anderson /* 38*4b56a003SDaniel Anderson * htonll(), ntohll(), htonl(), ntohl(), htons(), ntohs() 39*4b56a003SDaniel Anderson * These functions just return the input parameter, as the host 40*4b56a003SDaniel Anderson * byte order is the same as the network byte order (big endian). 41*4b56a003SDaniel Anderson * On little endian machines, these functions byte swap. 42*4b56a003SDaniel Anderson */ 43*4b56a003SDaniel Anderson 44*4b56a003SDaniel Anderson uint64_t 45*4b56a003SDaniel Anderson htonll(uint64_t in) 46*4b56a003SDaniel Anderson { 47*4b56a003SDaniel Anderson return (in); 48*4b56a003SDaniel Anderson } 49*4b56a003SDaniel Anderson 50*4b56a003SDaniel Anderson uint64_t 51*4b56a003SDaniel Anderson ntohll(uint64_t in) 52*4b56a003SDaniel Anderson { 53*4b56a003SDaniel Anderson return (in); 54*4b56a003SDaniel Anderson } 55*4b56a003SDaniel Anderson 5624da5b34Srie uint32_t 5724da5b34Srie htonl(uint32_t in) 5824da5b34Srie { 5924da5b34Srie return (in); 6024da5b34Srie } 6124da5b34Srie 6224da5b34Srie uint32_t 6324da5b34Srie ntohl(uint32_t in) 6424da5b34Srie { 6524da5b34Srie return (in); 6624da5b34Srie } 6724da5b34Srie 6824da5b34Srie uint16_t 6924da5b34Srie htons(uint16_t in) 7024da5b34Srie { 7124da5b34Srie return (in); 7224da5b34Srie } 7324da5b34Srie 7424da5b34Srie uint16_t 7524da5b34Srie ntohs(uint16_t in) 7624da5b34Srie { 7724da5b34Srie return (in); 7824da5b34Srie } 7924da5b34Srie 8024da5b34Srie #endif /* _LITTLE_ENDIAN */ 81