Skip to content

Commit f7ac03b

Browse files
committed
Make and work for 'half' (aka 'float16') datatype.
1 parent 7d05715 commit f7ac03b

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

CImg.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ enum {FALSE_WIN = 0};
214214

215215
// Define own datatypes to ensure portability.
216216
// ( 'sizeof(cimg_ulong/cimg_long) = sizeof(void*)' ).
217+
#ifdef cimg_use_half
218+
#define cimg_use_half 1
219+
#else
220+
#define cimg_use_half 0
221+
#endif
222+
217223
#define cimg_uint8 unsigned char
218224
#if defined(CHAR_MAX) && CHAR_MAX==255
219225
#define cimg_int8 signed char
@@ -224,6 +230,9 @@ enum {FALSE_WIN = 0};
224230
#define cimg_int16 short
225231
#define cimg_uint32 unsigned int
226232
#define cimg_int32 int
233+
#if cimg_use_half==1
234+
#define cimg_float16 half
235+
#endif
227236
#define cimg_float32 float
228237
#define cimg_float64 double
229238

@@ -276,12 +285,6 @@ enum {FALSE_WIN = 0};
276285
#endif
277286
#endif
278287

279-
#ifdef cimg_use_half
280-
#define cimg_use_half 1
281-
#else
282-
#define cimg_use_half 0
283-
#endif
284-
285288
// Configure filename separator.
286289
//
287290
// Filename separator is set by default to '/', except for Windows where it is '\'.
@@ -68370,6 +68373,9 @@ namespace cimg_library {
6837068373
_cimg_unserialize_case("int32","int",0,cimg_int32);
6837168374
_cimg_unserialize_case("uint64","unsigned_int64",0,cimg_uint64);
6837268375
_cimg_unserialize_case("int64",0,0,cimg_int64);
68376+
#if cimg_use_half==1
68377+
_cimg_unserialize_case("float16","half",0,cimg_float16);
68378+
#endif
6837368379
_cimg_unserialize_case("float32","float",0,cimg_float32);
6837468380
_cimg_unserialize_case("float64","double",0,cimg_float64);
6837568381
if (!loaded)

0 commit comments

Comments
 (0)