Blender  V3.3
Common.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #ifndef MIN
10 # define MIN(a, b) ((a) <= (b) ? (a) : (b))
11 #endif
12 #ifndef MAX
13 # define MAX(a, b) ((a) >= (b) ? (a) : (b))
14 #endif
15 #ifndef CLAMP
16 # define CLAMP(x, a, b) MIN(MAX((x), (a)), (b))
17 #endif
18 
19 template<typename T> inline void swap(T &a, T &b)
20 {
21  T tmp = a;
22  a = b;
23  b = tmp;
24 }
25 
26 typedef unsigned char uint8;
27 typedef unsigned short uint16;
28 typedef unsigned int uint;
29 typedef unsigned int uint32;
30 typedef unsigned long long uint64;
31 
32 // copied from nvtt src/nvimage/nvimage.h
33 inline uint computePitch(uint w, uint bitsize, uint alignment)
34 {
35  return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment;
36 }
unsigned int uint
Definition: BLI_sys_types.h:67
unsigned short uint16
Definition: Common.h:27
unsigned int uint32
Definition: Common.h:29
unsigned long long uint64
Definition: Common.h:30
uint computePitch(uint w, uint bitsize, uint alignment)
Definition: Common.h:33
unsigned int uint
Definition: Common.h:28
void swap(T &a, T &b)
Definition: Common.h:19
unsigned char uint8
Definition: Common.h:26
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
#define T
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)