00001 /* 00002 Simple Operating System for Smartcard Education 00003 Copyright (C) 2002 Matthias Bruestle <m@mbsks.franken.de> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00026 #ifndef SOSSE_TOOLS_H 00027 #define SOSSE_TOOLS_H 00028 00029 #include <config.h> 00030 #include <types.h> 00031 00033 #define swap_us(us) (((us&0x00FF)<<8)|((us&0xFF00)>>8)) 00034 00035 #define swap_ul(ul) (((ul&0x000000FF)<<24)|((ul&0x0000FF00)<<8)|((ul&0x00FF0000)>>8)|((ul&0xFF000000)>>24)) 00036 00042 void hton_us( iu16 *us, iu8 num ); 00048 void hton_ul( iu32 *ul, iu8 num ); 00049 00050 #ifndef ENDIAN_LITTLE 00051 #define hton_us(us) 00052 #define hton_ul(ul) 00053 #endif 00054 00056 #define min(a,b) ((a)<(b)?(a):(b)) 00057 00059 #define max(a,b) ((a)>(b)?(a):(b)) 00060 00061 #endif /* SOSSE_TOOLS_H */