We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bf9b72c commit 9c1fe09Copy full SHA for 9c1fe09
src/ccutil/helpers.h
@@ -25,6 +25,7 @@
25
#ifndef TESSERACT_CCUTIL_HELPERS_H_
26
#define TESSERACT_CCUTIL_HELPERS_H_
27
28
+#include <cassert>
29
#include <stdio.h>
30
#include <string.h>
31
#include <functional>
@@ -187,6 +188,7 @@ inline int IntCastRounded(float x) {
187
188
189
// Reverse the order of bytes in a n byte quantity for big/little-endian switch.
190
inline void ReverseN(void* ptr, int num_bytes) {
191
+ assert(num_bytes == 1 || num_bytes == 2 || num_bytes == 4 || num_bytes == 8);
192
char* cptr = static_cast<char*>(ptr);
193
int halfsize = num_bytes / 2;
194
for (int i = 0; i < halfsize; ++i) {
0 commit comments