Blender  V3.3
imbuf.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #pragma once
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <sys/types.h>
13 
14 #ifndef WIN32
15 # include <unistd.h>
16 #endif
17 
18 #include <fcntl.h>
19 #include <math.h>
20 #include <string.h>
21 #include <sys/stat.h>
22 
23 #ifndef WIN32
24 # include <sys/mman.h>
25 # define O_BINARY 0
26 #endif
27 
28 #define SWAP_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff))
29 #define SWAP_LONG(x) \
30  (((x) << 24) | (((x)&0xff00) << 8) | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
31 
32 #define ENDIAN_NOP(x) (x)
33 
34 #ifdef __BIG_ENDIAN__
35 # define LITTLE_SHORT SWAP_SHORT
36 # define LITTLE_LONG SWAP_LONG
37 # define BIG_SHORT ENDIAN_NOP
38 # define BIG_LONG ENDIAN_NOP
39 #else
40 # define LITTLE_SHORT ENDIAN_NOP
41 # define LITTLE_LONG ENDIAN_NOP
42 # define BIG_SHORT SWAP_SHORT
43 # define BIG_LONG SWAP_LONG
44 #endif
45 
46 #define IMB_DPI_DEFAULT 72.0f