From 04a0846fcb23f7c371187aa0682971663acf50b8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 7 Oct 2015 09:37:35 +0200 Subject: [PATCH] Add C++ operators Signed-off-by: Stefan Weil --- src/lib/openjp2/cio.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib/openjp2/cio.h b/src/lib/openjp2/cio.h index 1b684ef8..4a28a548 100644 --- a/src/lib/openjp2/cio.h +++ b/src/lib/openjp2/cio.h @@ -81,6 +81,25 @@ typedef enum } opj_stream_flag ; +#if defined(__cplusplus) + +static inline opj_stream_flag operator |=(opj_stream_flag a, opj_stream_flag b) +{ + return opj_stream_flag(int(a) | int(b)); +} + +static inline opj_stream_flag operator &=(opj_stream_flag a, opj_stream_flag b) +{ + return opj_stream_flag(int(a) & int(b)); +} + +static inline opj_stream_flag operator ~(opj_stream_flag a) +{ + return opj_stream_flag(~int(a)); +} + +#endif /* __cplusplus */ + /** Byte input-output stream. */