Skip to content

Commit 5202e86

Browse files
author
Dale Wilson
committed
Use integer limits INT_MIN, INT_MAX rather than literals. Buglet in VC won't let you express INT_MIN literally.
1 parent bdf4fac commit 5202e86

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

main/cpp/sbe/sbe.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <string.h>
2020
#include <stdint.h>
21+
#include <limits.h>
2122
#include <stdexcept>
2223

2324
/*

main/cpp/uk_co_real_logic_sbe_ir_generated/FrameCodec.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ class FrameCodec
157157

158158
static const sbe_int32_t irIdNullValue()
159159
{
160-
return -2147483648;
160+
return INT_MIN; // -2147483648;
161161
}
162162

163163
static const sbe_int32_t irIdMinValue()
164164
{
165-
return -2147483647;
165+
return INT_MIN + 1; // -2147483647;
166166
}
167167

168168
static const sbe_int32_t irIdMaxValue()
169169
{
170-
return 2147483647;
170+
return INT_MAX; // 2147483647;
171171
}
172172

173173
sbe_int32_t irId(void) const
@@ -211,17 +211,17 @@ class FrameCodec
211211

212212
static const sbe_int32_t irVersionNullValue()
213213
{
214-
return -2147483648;
214+
return INT_MIN; // -2147483648;
215215
}
216216

217217
static const sbe_int32_t irVersionMinValue()
218218
{
219-
return -2147483647;
219+
return INT_MIN + 1; // -2147483647;
220220
}
221221

222222
static const sbe_int32_t irVersionMaxValue()
223223
{
224-
return 2147483647;
224+
return INT_MAX; // 2147483647;
225225
}
226226

227227
sbe_int32_t irVersion(void) const
@@ -265,17 +265,17 @@ class FrameCodec
265265

266266
static const sbe_int32_t schemaVersionNullValue()
267267
{
268-
return -2147483648;
268+
return INT_MIN; // -2147483648;
269269
}
270270

271271
static const sbe_int32_t schemaVersionMinValue()
272272
{
273-
return -2147483647;
273+
return INT_MIN + 1; // -2147483647;
274274
}
275275

276276
static const sbe_int32_t schemaVersionMaxValue()
277277
{
278-
return 2147483647;
278+
return INT_MAX; // 2147483647;
279279
}
280280

281281
sbe_int32_t schemaVersion(void) const

main/cpp/uk_co_real_logic_sbe_ir_generated/TokenCodec.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ class TokenCodec
157157

158158
static const sbe_int32_t tokenOffsetNullValue()
159159
{
160-
return -2147483648;
160+
return INT_MIN; // -2147483648;
161161
}
162162

163163
static const sbe_int32_t tokenOffsetMinValue()
164164
{
165-
return -2147483647;
165+
return INT_MIN + 1; // -2147483647;
166166
}
167167

168168
static const sbe_int32_t tokenOffsetMaxValue()
169169
{
170-
return 2147483647;
170+
return INT_MAX; // 2147483647;
171171
}
172172

173173
sbe_int32_t tokenOffset(void) const
@@ -211,17 +211,17 @@ class TokenCodec
211211

212212
static const sbe_int32_t tokenSizeNullValue()
213213
{
214-
return -2147483648;
214+
return INT_MIN;// -2147483648;
215215
}
216216

217217
static const sbe_int32_t tokenSizeMinValue()
218218
{
219-
return -2147483647;
219+
return INT_MIN + 1; // -2147483647;
220220
}
221221

222222
static const sbe_int32_t tokenSizeMaxValue()
223223
{
224-
return 2147483647;
224+
return INT_MAX; // 2147483647;
225225
}
226226

227227
sbe_int32_t tokenSize(void) const
@@ -265,17 +265,17 @@ class TokenCodec
265265

266266
static const sbe_int32_t fieldIdNullValue()
267267
{
268-
return -2147483648;
268+
return INT_MIN; // -2147483648;
269269
}
270270

271271
static const sbe_int32_t fieldIdMinValue()
272272
{
273-
return -2147483647;
273+
return INT_MIN + 1; // -2147483647;
274274
}
275275

276276
static const sbe_int32_t fieldIdMaxValue()
277277
{
278-
return 2147483647;
278+
return INT_MAX; // 2147483647;
279279
}
280280

281281
sbe_int32_t fieldId(void) const
@@ -319,17 +319,17 @@ class TokenCodec
319319

320320
static const sbe_int32_t tokenVersionNullValue()
321321
{
322-
return -2147483648;
322+
return INT_MIN; // -2147483648;
323323
}
324324

325325
static const sbe_int32_t tokenVersionMinValue()
326326
{
327-
return -2147483647;
327+
return INT_MIN + 1; // -2147483647;
328328
}
329329

330330
static const sbe_int32_t tokenVersionMaxValue()
331331
{
332-
return 2147483647;
332+
return INT_MAX; // 2147483647;
333333
}
334334

335335
sbe_int32_t tokenVersion(void) const

perf/resources/sbe/sbe.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <string.h>
2020
#include <stdint.h>
21+
#include <limits.h>
2122
#include <stdexcept>
2223

2324
/*

0 commit comments

Comments
 (0)