1*7421SDaniel.Anderson@Sun.COM /* 2*7421SDaniel.Anderson@Sun.COM * CDDL HEADER START 3*7421SDaniel.Anderson@Sun.COM * 4*7421SDaniel.Anderson@Sun.COM * The contents of this file are subject to the terms of the 5*7421SDaniel.Anderson@Sun.COM * Common Development and Distribution License (the "License"). 6*7421SDaniel.Anderson@Sun.COM * You may not use this file except in compliance with the License. 7*7421SDaniel.Anderson@Sun.COM * 8*7421SDaniel.Anderson@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7421SDaniel.Anderson@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7421SDaniel.Anderson@Sun.COM * See the License for the specific language governing permissions 11*7421SDaniel.Anderson@Sun.COM * and limitations under the License. 12*7421SDaniel.Anderson@Sun.COM * 13*7421SDaniel.Anderson@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7421SDaniel.Anderson@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7421SDaniel.Anderson@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7421SDaniel.Anderson@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7421SDaniel.Anderson@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7421SDaniel.Anderson@Sun.COM * 19*7421SDaniel.Anderson@Sun.COM * CDDL HEADER END 20*7421SDaniel.Anderson@Sun.COM */ 21*7421SDaniel.Anderson@Sun.COM 22*7421SDaniel.Anderson@Sun.COM /* 23*7421SDaniel.Anderson@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*7421SDaniel.Anderson@Sun.COM * Use is subject to license terms. 25*7421SDaniel.Anderson@Sun.COM */ 26*7421SDaniel.Anderson@Sun.COM 27*7421SDaniel.Anderson@Sun.COM #include <sys/isa_defs.h> 28*7421SDaniel.Anderson@Sun.COM #include <sys/types.h> 29*7421SDaniel.Anderson@Sun.COM #include <netinet/in.h> 30*7421SDaniel.Anderson@Sun.COM #include <inttypes.h> 31*7421SDaniel.Anderson@Sun.COM 32*7421SDaniel.Anderson@Sun.COM #if (defined(_BIG_ENDIAN) || defined(_LP64)) && !defined(__lint) 33*7421SDaniel.Anderson@Sun.COM 34*7421SDaniel.Anderson@Sun.COM #error Use ISA-dependent byteorder64.c only on a 32-bit little-endian machine. 35*7421SDaniel.Anderson@Sun.COM 36*7421SDaniel.Anderson@Sun.COM #else 37*7421SDaniel.Anderson@Sun.COM 38*7421SDaniel.Anderson@Sun.COM uint64_t htonll(uint64_t in)39*7421SDaniel.Anderson@Sun.COMhtonll(uint64_t in) 40*7421SDaniel.Anderson@Sun.COM { 41*7421SDaniel.Anderson@Sun.COM return (htonl(in >> 32) | ((uint64_t)htonl(in) << 32)); 42*7421SDaniel.Anderson@Sun.COM } 43*7421SDaniel.Anderson@Sun.COM 44*7421SDaniel.Anderson@Sun.COM uint64_t ntohll(uint64_t in)45*7421SDaniel.Anderson@Sun.COMntohll(uint64_t in) 46*7421SDaniel.Anderson@Sun.COM { 47*7421SDaniel.Anderson@Sun.COM return (ntohl(in >> 32) | (uint64_t)ntohl(in) << 32); 48*7421SDaniel.Anderson@Sun.COM } 49*7421SDaniel.Anderson@Sun.COM 50*7421SDaniel.Anderson@Sun.COM #endif /* (_BIG_ENDIAN) || _LP64) && !__lint */ 51