00001 //*************************************************************************** 00002 // This source code is copyrighted 2002 by Google Inc. All rights 00003 // reserved. You are given a limited license to use this source code for 00004 // purposes of participating in the Google programming contest. If you 00005 // choose to use or distribute the source code for any other purpose, you 00006 // must either (1) first obtain written approval from Google, or (2) 00007 // prominently display the foregoing copyright notice and the following 00008 // warranty and liability disclaimer on each copy used or distributed. 00009 // 00010 // The source code and repository (the "Software") is provided "AS IS", 00011 // with no warranty, express or implied, including but not limited to the 00012 // implied warranties of merchantability and fitness for a particular 00013 // use. In no event shall Google Inc. be liable for any damages, direct 00014 // or indirect, even if advised of the possibility of such damages. 00015 //*************************************************************************** 00016 00017 00018 #ifndef _BASICTYPES_H_ 00019 #define _BASICTYPES_H_ 00020 00021 #include <limits.h> // So we can set the bounds of our types 00022 #include "port.h" // Types that only need exist on certain systems 00023 00024 // Standard typedefs 00025 // All Google2 code is compiled with -funsigned-char to make "char" 00026 // unsigned. Google2 code therefore doesn't need a "uchar" type. 00027 typedef signed char schar; 00028 00029 typedef short int16; 00030 typedef int int32; 00031 typedef long long int64; 00032 00033 // NOTE: unsigned types are DANGEROUS in loops and other arithmetical 00034 // places. Use the signed types unless your variable represents a bit 00035 // pattern (eg a hash value) or you really need the extra bit. Do NOT 00036 // use 'unsigned' to express "this value should always be positive"; 00037 // use assertions for this. 00038 typedef unsigned short uint16; 00039 typedef unsigned int uint32; 00040 typedef unsigned long long uint64; 00041 00042 const uint16 kuint16max = ((uint16) 0xFFFF); 00043 const uint64 kuint64max = ((uint64) 0xFFFFFFFFFFFFFFFFLL); 00044 const int32 kint32max = (( int32) 0x7FFFFFFF); 00045 const int64 kint64min = (( int64) 0x8000000000000000LL); 00046 const int64 kint64max = (( int64) 0x7FFFFFFFFFFFFFFFLL); 00047 00048 // Don't make NULL a void* because it leads to type errors with strict 00049 // checking. 00050 #undef NULL 00051 #define NULL 0 00052 00053 00054 // A macro to disallow the evil copy constructor and operator= functions 00055 // This should be used in the private: declarations for a class 00056 #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \ 00057 TypeName(const TypeName&); \ 00058 void operator=(const TypeName&) 00059 00060 #endif // _BASICTYPES_H_