Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Common.h « dds « intern « imbuf « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bcc7b4f0278c589bfd59ee8697ca420ac68bdb3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup imbdds
 */

#pragma once

#ifndef MIN
#  define MIN(a, b) ((a) <= (b) ? (a) : (b))
#endif
#ifndef MAX
#  define MAX(a, b) ((a) >= (b) ? (a) : (b))
#endif
#ifndef CLAMP
#  define CLAMP(x, a, b) MIN(MAX((x), (a)), (b))
#endif

template<typename T> inline void swap(T &a, T &b)
{
  T tmp = a;
  a = b;
  b = tmp;
}

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint;
typedef unsigned int uint32;
typedef unsigned long long uint64;

// copied from nvtt src/nvimage/nvimage.h
inline uint computePitch(uint w, uint bitsize, uint alignment)
{
  return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment;
}