Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * Contributors: Amorilia (amorilia@users.sourceforge.net) 00019 * 00020 * ***** END GPL LICENSE BLOCK ***** 00021 */ 00022 00028 #ifndef _DDS_COMMON_H 00029 #define _DDS_COMMON_H 00030 00031 #ifndef min 00032 #define min(a,b) ((a) <= (b) ? (a) : (b)) 00033 #endif 00034 #ifndef max 00035 #define max(a,b) ((a) >= (b) ? (a) : (b)) 00036 #endif 00037 #ifndef clamp 00038 #define clamp(x,a,b) min(max((x), (a)), (b)) 00039 #endif 00040 00041 template<typename T> 00042 inline void 00043 swap(T & a, T & b) 00044 { 00045 T tmp = a; 00046 a = b; 00047 b = tmp; 00048 } 00049 00050 typedef unsigned char uint8; 00051 typedef unsigned short uint16; 00052 typedef unsigned int uint; 00053 typedef unsigned int uint32; 00054 typedef unsigned long long uint64; 00055 00056 // copied from nvtt src/nvimage/nvimage.h 00057 inline uint computePitch(uint w, uint bitsize, uint alignment) 00058 { 00059 return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment; 00060 } 00061 00062 #endif