2b6e762c557496a41438c0b105d604f60c593682ahl/*
2b6e762c557496a41438c0b105d604f60c593682ahl * CDDL HEADER START
2b6e762c557496a41438c0b105d604f60c593682ahl *
2b6e762c557496a41438c0b105d604f60c593682ahl * The contents of this file are subject to the terms of the
2b6e762c557496a41438c0b105d604f60c593682ahl * Common Development and Distribution License (the "License").
2b6e762c557496a41438c0b105d604f60c593682ahl * You may not use this file except in compliance with the License.
2b6e762c557496a41438c0b105d604f60c593682ahl *
2b6e762c557496a41438c0b105d604f60c593682ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2b6e762c557496a41438c0b105d604f60c593682ahl * or http://www.opensolaris.org/os/licensing.
2b6e762c557496a41438c0b105d604f60c593682ahl * See the License for the specific language governing permissions
2b6e762c557496a41438c0b105d604f60c593682ahl * and limitations under the License.
2b6e762c557496a41438c0b105d604f60c593682ahl *
2b6e762c557496a41438c0b105d604f60c593682ahl * When distributing Covered Code, include this CDDL HEADER in each
2b6e762c557496a41438c0b105d604f60c593682ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2b6e762c557496a41438c0b105d604f60c593682ahl * If applicable, add the following below this CDDL HEADER, with the
2b6e762c557496a41438c0b105d604f60c593682ahl * fields enclosed by brackets "[]" replaced with your own identifying
2b6e762c557496a41438c0b105d604f60c593682ahl * information: Portions Copyright [yyyy] [name of copyright owner]
2b6e762c557496a41438c0b105d604f60c593682ahl *
2b6e762c557496a41438c0b105d604f60c593682ahl * CDDL HEADER END
2b6e762c557496a41438c0b105d604f60c593682ahl */
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahl/*
2b6e762c557496a41438c0b105d604f60c593682ahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2b6e762c557496a41438c0b105d604f60c593682ahl * Use is subject to license terms.
2b6e762c557496a41438c0b105d604f60c593682ahl */
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahl#pragma ident "%Z%%M% %I% %E% SMI"
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahl/*
2b6e762c557496a41438c0b105d604f60c593682ahl * ASSERTION: Test network byte-ordering routines.
2b6e762c557496a41438c0b105d604f60c593682ahl */
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahl#include <sys/isa_defs.h>
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl before[0] = 0x1122LL;
2b6e762c557496a41438c0b105d604f60c593682ahl before[1] = 0x11223344LL;
2b6e762c557496a41438c0b105d604f60c593682ahl before[2] = 0x1122334455667788LL;
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahl#ifdef _LITTLE_ENDIAN
2b6e762c557496a41438c0b105d604f60c593682ahl after[0] = 0x2211LL;
2b6e762c557496a41438c0b105d604f60c593682ahl after[1] = 0x44332211LL;
2b6e762c557496a41438c0b105d604f60c593682ahl after[2] = 0x8877665544332211LL;
2b6e762c557496a41438c0b105d604f60c593682ahl#else
2b6e762c557496a41438c0b105d604f60c593682ahl after[0] = 0x1122LL;
2b6e762c557496a41438c0b105d604f60c593682ahl after[1] = 0x11223344LL;
2b6e762c557496a41438c0b105d604f60c593682ahl after[2] = 0x1122334455667788LL;
2b6e762c557496a41438c0b105d604f60c593682ahl#endif
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[0] != htons(before[0])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", htons(before[0]), after[0]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[0] != ntohs(before[0])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", ntohs(before[0]), after[0]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[1] != htonl(before[1])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", htonl(before[1]), after[1]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[1] != ntohl(before[1])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", ntohl(before[1]), after[1]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[2] != htonll(before[2])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", htonll(before[2]), after[2]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl/after[2] != ntohll(before[2])/
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl printf("%x rather than %x", ntohll(before[2]), after[2]);
2b6e762c557496a41438c0b105d604f60c593682ahl exit(1);
2b6e762c557496a41438c0b105d604f60c593682ahl}
2b6e762c557496a41438c0b105d604f60c593682ahl
2b6e762c557496a41438c0b105d604f60c593682ahlBEGIN
2b6e762c557496a41438c0b105d604f60c593682ahl{
2b6e762c557496a41438c0b105d604f60c593682ahl exit(0);
2b6e762c557496a41438c0b105d604f60c593682ahl}