[x265] [PATCH 2 of 3] bitstream: convert macros into inline members for better compile-time checking

Steve Borho steve at borho.org
Thu Jul 10 23:44:00 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1405019223 18000
#      Thu Jul 10 14:07:03 2014 -0500
# Node ID b96714bdda859e6be60c9e2056e3d5296e20d2dc
# Parent  64dc40d52519b0bcb19c04cf14d510243ff846fb
bitstream: convert macros into inline members for better compile-time checking

diff -r 64dc40d52519 -r b96714bdda85 source/common/bitstream.h
--- a/source/common/bitstream.h	Thu Jul 10 13:59:19 2014 -0500
+++ b/source/common/bitstream.h	Thu Jul 10 14:07:03 2014 -0500
@@ -133,11 +133,6 @@
         return bitSize[tmp >> 8] + 16;
 }
 
-#define WRITE_CODE(code, length, name) writeCode(code, length)
-#define WRITE_UVLC(code,         name) writeUvlc(code)
-#define WRITE_SVLC(code,         name) writeSvlc(code)
-#define WRITE_FLAG(code,         name) writeFlag(code)
-
 class SyntaxElementWriter
 {
 public:
@@ -146,6 +141,12 @@
 
     SyntaxElementWriter() : m_bitIf(NULL) {}
 
+    /* silently discard the name of the syntax element */
+    inline void WRITE_CODE(uint32_t code, uint32_t length, const char *) { writeCode(code, length); }
+    inline void WRITE_UVLC(uint32_t code,                  const char *) { writeUvlc(code); }
+    inline void WRITE_SVLC(int32_t  code,                  const char *) { writeSvlc(code); }
+    inline void WRITE_FLAG(uint32_t code,                  const char *) { writeFlag(code); }
+
     void writeCode(uint32_t code, uint32_t length);
     void writeUvlc(uint32_t code);
     void writeSvlc(int32_t code);


More information about the x265-devel mailing list