X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Ffnetorderstream.h;h=f58550b32923a76944141e1ae48af764ba93fced;hb=d16eb37cbc73f67fc29a60645e0b1ac7fe32767e;hp=a8559390b857ca874b7bc578253fdd3e4c618af4;hpb=dc034c9d0b7d9c3874a324a4c2c189a02945adc8;p=ctsim.git diff --git a/include/fnetorderstream.h b/include/fnetorderstream.h index a855939..f58550b 100644 --- a/include/fnetorderstream.h +++ b/include/fnetorderstream.h @@ -1,31 +1,31 @@ -/***************************************************************************** -** FILE IDENTIFICATION -** -** Name: fnetorderstream.h -** Purpose: Network-order file stream header -** Programmer: Kevin Rosenberg -** Date Started: Sep 2000 -** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: fnetorderstream.h,v 1.6 2000/12/16 06:12:47 kevin Exp $ -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -******************************************************************************/ - - +/***************************************************************************** +** FILE IDENTIFICATION +** +** Name: fnetorderstream.h +** Purpose: Network-order file stream header +** Programmer: Kevin Rosenberg +** Date Started: Sep 2000 +** +** This is part of the CTSim program +** Copyright (c) 1983-2001 Kevin Rosenberg +** +** $Id: fnetorderstream.h,v 1.9 2001/03/13 04:44:25 kevin Exp $ +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License (version 2) as +** published by the Free Software Foundation. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +******************************************************************************/ + + #ifndef NETORDER_H #define NETORDER_H @@ -88,6 +88,29 @@ SwapBytes8 (void* buffer) p[4] = temp; } +inline void +SwapBytes2IfLittleEndian (void* buffer) +{ +#ifndef WORDS_BIGENDIAN + SwapBytes2 (buffer); +#endif +} + +inline void +SwapBytes4IfLittleEndian (void* buffer) +{ +#ifndef WORDS_BIGENDIAN + SwapBytes4 (buffer); +#endif +} + +inline void +SwapBytes8IfLittleEndian (void* buffer) +{ +#ifndef WORDS_BIGENDIAN + SwapBytes8 (buffer); +#endif +} void ConvertNetworkOrder (void* buffer, size_t bytes); void ConvertReverseNetworkOrder (void* buffer, size_t bytes);