diff options
Diffstat (limited to 'include/generic.h')
-rw-r--r-- | include/generic.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/include/generic.h b/include/generic.h index 62a9942..a8f3be5 100644 --- a/include/generic.h +++ b/include/generic.h @@ -1,27 +1,5 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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 __GENERIC_H__ #define __GENERIC_H__ -#ifdef __cplusplus -#include "String.h" -#endif #define M_BARE -1 #define M_ERROR 0 @@ -77,6 +55,16 @@ typedef Uint16 Word; typedef Uint32 DWord; #endif +#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ +typedef long long int64; +typedef unsigned long long uint64; +#elif defined _WIN32 +typedef _int64 int64; +typedef unsigned _int64 int64; +#else +#error Unsupported platform (need 64 bits ints definition) +#endif + #if defined __linux__ || defined __CYGWIN32__ #define PACKED __attribute__((packed)) #else @@ -87,6 +75,7 @@ extern char verbosity; char ** split(char * s, char t); #ifdef __cplusplus +#include <String.h> void printm(int level, String fmt, ...); #ifndef MAX @@ -114,6 +103,11 @@ inline T MIN(T a, T b) { #endif +#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) +#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + - (((x)>>2)&0x33333333) \ + - (((x)>>3)&0x11111111)) + #include <sys/types.h> #include <sys/stat.h> @@ -125,4 +119,14 @@ inline T MIN(T a, T b) { #error Unknow compiler/platform #endif +#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ +typedef long long int64; +typedef unsigned long long uint64; +#elif defined _WIN32 +typedef _int64 int64; +typedef unsigned _int64 int64; +#else +#error Unsupported platform (need 64 bits ints definition) +#endif + #endif |