summaryrefslogtreecommitdiff
path: root/magick/image-private.h
diff options
context:
space:
mode:
Diffstat (limited to 'magick/image-private.h')
-rw-r--r--magick/image-private.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/magick/image-private.h b/magick/image-private.h
index b8bae5a..659f57b 100644
--- a/magick/image-private.h
+++ b/magick/image-private.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 - 2020 GraphicsMagick Group
+ Copyright (C) 2018 - 2022 GraphicsMagick Group
This program is covered by multiple licenses, which are described in
Copyright.txt. You should have received a copy of Copyright.txt with this
@@ -9,6 +9,20 @@
*/
/*
+ Maximum unsigned RGB value which fits in the specified bits
+
+ If bits <= 0, then zero is returned. If bits exceeds bits in unsigned long,
+ then max value of unsigned long is returned.
+
+ Emulates ((1U << bits)-1) but without the overflow problems.
+*/
+#define MaxValueGivenBits(bits) \
+ ((unsigned long) \
+ ((bits <= 0) ? 0 : \
+ ((0x01UL << (Min(sizeof(unsigned long)*8U,(size_t)bits)-1)) + \
+ ((0x01UL << (Min(sizeof(unsigned long)*8U,(size_t)bits)-1))-1))))
+
+/*
ImageExtra allows for expansion of Image without increasing its
size. The internals are defined only in this private header file.
Clients using the library can access the internals via the access