PostgreSQL Source Code git master
int.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static bool pg_add_s16_overflow (int16 a, int16 b, int16 *result)
 
static bool pg_sub_s16_overflow (int16 a, int16 b, int16 *result)
 
static bool pg_mul_s16_overflow (int16 a, int16 b, int16 *result)
 
static bool pg_neg_s16_overflow (int16 a, int16 *result)
 
static uint16 pg_abs_s16 (int16 a)
 
static bool pg_add_s32_overflow (int32 a, int32 b, int32 *result)
 
static bool pg_sub_s32_overflow (int32 a, int32 b, int32 *result)
 
static bool pg_mul_s32_overflow (int32 a, int32 b, int32 *result)
 
static bool pg_neg_s32_overflow (int32 a, int32 *result)
 
static uint32 pg_abs_s32 (int32 a)
 
static bool pg_add_s64_overflow (int64 a, int64 b, int64 *result)
 
static bool pg_sub_s64_overflow (int64 a, int64 b, int64 *result)
 
static bool pg_mul_s64_overflow (int64 a, int64 b, int64 *result)
 
static bool pg_neg_s64_overflow (int64 a, int64 *result)
 
static uint64 pg_abs_s64 (int64 a)
 
static bool pg_add_u16_overflow (uint16 a, uint16 b, uint16 *result)
 
static bool pg_sub_u16_overflow (uint16 a, uint16 b, uint16 *result)
 
static bool pg_mul_u16_overflow (uint16 a, uint16 b, uint16 *result)
 
static bool pg_neg_u16_overflow (uint16 a, int16 *result)
 
static bool pg_add_u32_overflow (uint32 a, uint32 b, uint32 *result)
 
static bool pg_sub_u32_overflow (uint32 a, uint32 b, uint32 *result)
 
static bool pg_mul_u32_overflow (uint32 a, uint32 b, uint32 *result)
 
static bool pg_neg_u32_overflow (uint32 a, int32 *result)
 
static bool pg_add_u64_overflow (uint64 a, uint64 b, uint64 *result)
 
static bool pg_sub_u64_overflow (uint64 a, uint64 b, uint64 *result)
 
static bool pg_mul_u64_overflow (uint64 a, uint64 b, uint64 *result)
 
static bool pg_neg_u64_overflow (uint64 a, int64 *result)
 
static int pg_cmp_s16 (int16 a, int16 b)
 
static int pg_cmp_u16 (uint16 a, uint16 b)
 
static int pg_cmp_s32 (int32 a, int32 b)
 
static int pg_cmp_u32 (uint32 a, uint32 b)
 
static int pg_cmp_s64 (int64 a, int64 b)
 
static int pg_cmp_u64 (uint64 a, uint64 b)
 
static int pg_cmp_size (size_t a, size_t b)
 

Function Documentation

◆ pg_abs_s16()

static uint16 pg_abs_s16 ( int16  a)
inlinestatic

Definition at line 137 of file int.h.

138{
139 /*
140 * This first widens the argument from int16 to int32 for use with abs().
141 * The result is then narrowed from int32 to uint16. This prevents any
142 * possibility of overflow.
143 */
144 return (uint16) abs((int32) a);
145}
int32_t int32
Definition: c.h:498
uint16_t uint16
Definition: c.h:501
int a
Definition: isn.c:73

References a.

◆ pg_abs_s32()

static uint32 pg_abs_s32 ( int32  a)
inlinestatic

Definition at line 221 of file int.h.

222{
223 /*
224 * This first widens the argument from int32 to int64 for use with
225 * i64abs(). The result is then narrowed from int64 to uint32. This
226 * prevents any possibility of overflow.
227 */
228 return (uint32) i64abs((int64) a);
229}
int64_t int64
Definition: c.h:499
uint32_t uint32
Definition: c.h:502

References a.

Referenced by jsonb_array_element(), jsonb_array_element_text(), jsonb_delete_idx(), power_var_int(), and setPathArray().

◆ pg_abs_s64()

static uint64 pg_abs_s64 ( int64  a)
inlinestatic

Definition at line 352 of file int.h.

353{
354 if (unlikely(a == PG_INT64_MIN))
355 return (uint64) PG_INT64_MAX + 1;
356 return (uint64) i64abs(a);
357}
#define PG_INT64_MAX
Definition: c.h:563
#define PG_INT64_MIN
Definition: c.h:562
uint64_t uint64
Definition: c.h:503
#define unlikely(x)
Definition: c.h:347

References a, PG_INT64_MAX, PG_INT64_MIN, and unlikely.

Referenced by cash_out(), and int64_to_numericvar().

◆ pg_add_s16_overflow()

static bool pg_add_s16_overflow ( int16  a,
int16  b,
int16 result 
)
inlinestatic

Definition at line 67 of file int.h.

68{
69#if defined(HAVE__BUILTIN_OP_OVERFLOW)
70 return __builtin_add_overflow(a, b, result);
71#else
72 int32 res = (int32) a + (int32) b;
73
74 if (res > PG_INT16_MAX || res < PG_INT16_MIN)
75 {
76 *result = 0x5EED; /* to avoid spurious warnings */
77 return true;
78 }
79 *result = (int16) res;
80 return false;
81#endif
82}
int16_t int16
Definition: c.h:497
#define PG_INT16_MIN
Definition: c.h:556
#define PG_INT16_MAX
Definition: c.h:557
int b
Definition: isn.c:74

References a, b, PG_INT16_MAX, and PG_INT16_MIN.

Referenced by AdjustNotNullInheritance(), ATExecAddColumn(), ATExecSetNotNull(), ConstraintSetParentConstraint(), int2pl(), MergeAttributesIntoExisting(), MergeCheckConstraint(), MergeConstraintsIntoExisting(), MergeInheritedAttribute(), and MergeWithExistingConstraint().

◆ pg_add_s32_overflow()

static bool pg_add_s32_overflow ( int32  a,
int32  b,
int32 result 
)
inlinestatic

◆ pg_add_s64_overflow()

static bool pg_add_s64_overflow ( int64  a,
int64  b,
int64 result 
)
inlinestatic

Definition at line 235 of file int.h.

236{
237#if defined(HAVE__BUILTIN_OP_OVERFLOW)
238 return __builtin_add_overflow(a, b, result);
239#elif defined(HAVE_INT128)
240 int128 res = (int128) a + (int128) b;
241
242 if (res > PG_INT64_MAX || res < PG_INT64_MIN)
243 {
244 *result = 0x5EED; /* to avoid spurious warnings */
245 return true;
246 }
247 *result = (int64) res;
248 return false;
249#else
250 if ((a > 0 && b > 0 && a > PG_INT64_MAX - b) ||
251 (a < 0 && b < 0 && a < PG_INT64_MIN - b))
252 {
253 *result = 0x5EED; /* to avoid spurious warnings */
254 return true;
255 }
256 *result = a + b;
257 return false;
258#endif
259}

References a, b, PG_INT64_MAX, and PG_INT64_MIN.

Referenced by AdjustFractMicroseconds(), AdjustIntervalForTypmod(), cash_pl_cash(), DecodeInterval(), evalStandardFunc(), finite_interval_pl(), generate_series_step_int8(), in_range_int4_int8(), in_range_int8_int8(), in_range_time_interval(), in_range_timetz_interval(), int28pl(), int48pl(), int64_multiply_add(), int82pl(), int84pl(), int8inc(), int8pl(), interval_part_common(), itm2interval(), make_interval(), make_timestamp_internal(), timestamp_bin(), timestamp_pl_interval(), timestamptz_bin(), timestamptz_pl_interval_internal(), and tm2timestamp().

◆ pg_add_u16_overflow()

static bool pg_add_u16_overflow ( uint16  a,
uint16  b,
uint16 result 
)
inlinestatic

Definition at line 368 of file int.h.

369{
370#if defined(HAVE__BUILTIN_OP_OVERFLOW)
371 return __builtin_add_overflow(a, b, result);
372#else
373 uint16 res = a + b;
374
375 if (res < a)
376 {
377 *result = 0x5EED; /* to avoid spurious warnings */
378 return true;
379 }
380 *result = res;
381 return false;
382#endif
383}

References a, and b.

◆ pg_add_u32_overflow()

static bool pg_add_u32_overflow ( uint32  a,
uint32  b,
uint32 result 
)
inlinestatic

Definition at line 441 of file int.h.

442{
443#if defined(HAVE__BUILTIN_OP_OVERFLOW)
444 return __builtin_add_overflow(a, b, result);
445#else
446 uint32 res = a + b;
447
448 if (res < a)
449 {
450 *result = 0x5EED; /* to avoid spurious warnings */
451 return true;
452 }
453 *result = res;
454 return false;
455#endif
456}

References a, and b.

◆ pg_add_u64_overflow()

static bool pg_add_u64_overflow ( uint64  a,
uint64  b,
uint64 result 
)
inlinestatic

Definition at line 514 of file int.h.

515{
516#if defined(HAVE__BUILTIN_OP_OVERFLOW)
517 return __builtin_add_overflow(a, b, result);
518#else
519 uint64 res = a + b;
520
521 if (res < a)
522 {
523 *result = 0x5EED; /* to avoid spurious warnings */
524 return true;
525 }
526 *result = res;
527 return false;
528#endif
529}

References a, and b.

Referenced by basic_archive_file(), and numericvar_to_uint64().

◆ pg_cmp_s16()

static int pg_cmp_s16 ( int16  a,
int16  b 
)
inlinestatic

Definition at line 634 of file int.h.

635{
636 return (int32) a - (int32) b;
637}

References a, and b.

Referenced by _bt_delitems_cmp(), _bt_splitcmp(), AttrDefaultCmp(), and cmpNodePtr().

◆ pg_cmp_s32()

static int pg_cmp_s32 ( int32  a,
int32  b 
)
inlinestatic

Definition at line 646 of file int.h.

647{
648 return (a > b) - (a < b);
649}

References a, and b.

Referenced by cmp_list_len_asc(), comp_location(), comp_ptrgm(), compare_int(), comparecost(), compareint(), compareWordEntryPos(), db_comparator(), int_cmp(), library_name_compare(), list_int_cmp(), and rankCompare().

◆ pg_cmp_s64()

static int pg_cmp_s64 ( int64  a,
int64  b 
)
inlinestatic

Definition at line 658 of file int.h.

659{
660 return (a > b) - (a < b);
661}

References a, and b.

◆ pg_cmp_size()

static int pg_cmp_size ( size_t  a,
size_t  b 
)
inlinestatic

Definition at line 670 of file int.h.

671{
672 return (a > b) - (a < b);
673}

References a, and b.

Referenced by library_name_compare().

◆ pg_cmp_u16()

static int pg_cmp_u16 ( uint16  a,
uint16  b 
)
inlinestatic

Definition at line 640 of file int.h.

641{
642 return (int32) a - (int32) b;
643}

References a, and b.

Referenced by cmpOffsetNumbers().

◆ pg_cmp_u32()

static int pg_cmp_u32 ( uint32  a,
uint32  b 
)
inlinestatic

◆ pg_cmp_u64()

static int pg_cmp_u64 ( uint64  a,
uint64  b 
)
inlinestatic

Definition at line 664 of file int.h.

665{
666 return (a > b) - (a < b);
667}

References a, and b.

Referenced by cmp_lsn(), file_sort_by_lsn(), ginCompareItemPointers(), key_cmp(), and ListComparatorForWalSummaryFiles().

◆ pg_mul_s16_overflow()

static bool pg_mul_s16_overflow ( int16  a,
int16  b,
int16 result 
)
inlinestatic

Definition at line 103 of file int.h.

104{
105#if defined(HAVE__BUILTIN_OP_OVERFLOW)
106 return __builtin_mul_overflow(a, b, result);
107#else
108 int32 res = (int32) a * (int32) b;
109
110 if (res > PG_INT16_MAX || res < PG_INT16_MIN)
111 {
112 *result = 0x5EED; /* to avoid spurious warnings */
113 return true;
114 }
115 *result = (int16) res;
116 return false;
117#endif
118}

References a, b, PG_INT16_MAX, and PG_INT16_MIN.

Referenced by int2mul().

◆ pg_mul_s32_overflow()

static bool pg_mul_s32_overflow ( int32  a,
int32  b,
int32 result 
)
inlinestatic

Definition at line 187 of file int.h.

188{
189#if defined(HAVE__BUILTIN_OP_OVERFLOW)
190 return __builtin_mul_overflow(a, b, result);
191#else
192 int64 res = (int64) a * (int64) b;
193
194 if (res > PG_INT32_MAX || res < PG_INT32_MIN)
195 {
196 *result = 0x5EED; /* to avoid spurious warnings */
197 return true;
198 }
199 *result = (int32) res;
200 return false;
201#endif
202}

References a, b, PG_INT32_MAX, and PG_INT32_MIN.

Referenced by AdjustDays(), AdjustYears(), DCH_from_char(), do_to_timestamp(), int24mul(), int42mul(), int4lcm(), int4mul(), lpad(), make_interval(), repeat(), rpad(), text_format_parse_digits(), text_substring(), and translate().

◆ pg_mul_s64_overflow()

static bool pg_mul_s64_overflow ( int64  a,
int64  b,
int64 result 
)
inlinestatic

Definition at line 293 of file int.h.

294{
295#if defined(HAVE__BUILTIN_OP_OVERFLOW)
296 return __builtin_mul_overflow(a, b, result);
297#elif defined(HAVE_INT128)
298 int128 res = (int128) a * (int128) b;
299
300 if (res > PG_INT64_MAX || res < PG_INT64_MIN)
301 {
302 *result = 0x5EED; /* to avoid spurious warnings */
303 return true;
304 }
305 *result = (int64) res;
306 return false;
307#else
308 /*
309 * Overflow can only happen if at least one value is outside the range
310 * sqrt(min)..sqrt(max) so check that first as the division can be quite a
311 * bit more expensive than the multiplication.
312 *
313 * Multiplying by 0 or 1 can't overflow of course and checking for 0
314 * separately avoids any risk of dividing by 0. Be careful about dividing
315 * INT_MIN by -1 also, note reversing the a and b to ensure we're always
316 * dividing it by a positive value.
317 *
318 */
319 if ((a > PG_INT32_MAX || a < PG_INT32_MIN ||
320 b > PG_INT32_MAX || b < PG_INT32_MIN) &&
321 a != 0 && a != 1 && b != 0 && b != 1 &&
322 ((a > 0 && b > 0 && a > PG_INT64_MAX / b) ||
323 (a > 0 && b < 0 && b < PG_INT64_MIN / a) ||
324 (a < 0 && b > 0 && a < PG_INT64_MIN / b) ||
325 (a < 0 && b < 0 && a < PG_INT64_MAX / b)))
326 {
327 *result = 0x5EED; /* to avoid spurious warnings */
328 return true;
329 }
330 *result = a * b;
331 return false;
332#endif
333}

References a, b, PG_INT32_MAX, PG_INT32_MIN, PG_INT64_MAX, and PG_INT64_MIN.

Referenced by cash_in(), cash_mul_int64(), DecodeInterval(), evalStandardFunc(), int28mul(), int48mul(), int64_div_fast_to_numeric(), int64_multiply_add(), int82mul(), int84mul(), int8lcm(), int8mul(), interval_part_common(), itm2interval(), make_timestamp_internal(), numericvar_to_int64(), strtoint64(), timestamp_bin(), timestamptz_bin(), and tm2timestamp().

◆ pg_mul_u16_overflow()

static bool pg_mul_u16_overflow ( uint16  a,
uint16  b,
uint16 result 
)
inlinestatic

Definition at line 402 of file int.h.

403{
404#if defined(HAVE__BUILTIN_OP_OVERFLOW)
405 return __builtin_mul_overflow(a, b, result);
406#else
407 uint32 res = (uint32) a * (uint32) b;
408
409 if (res > PG_UINT16_MAX)
410 {
411 *result = 0x5EED; /* to avoid spurious warnings */
412 return true;
413 }
414 *result = (uint16) res;
415 return false;
416#endif
417}
#define PG_UINT16_MAX
Definition: c.h:558

References a, b, and PG_UINT16_MAX.

◆ pg_mul_u32_overflow()

static bool pg_mul_u32_overflow ( uint32  a,
uint32  b,
uint32 result 
)
inlinestatic

Definition at line 475 of file int.h.

476{
477#if defined(HAVE__BUILTIN_OP_OVERFLOW)
478 return __builtin_mul_overflow(a, b, result);
479#else
480 uint64 res = (uint64) a * (uint64) b;
481
482 if (res > PG_UINT32_MAX)
483 {
484 *result = 0x5EED; /* to avoid spurious warnings */
485 return true;
486 }
487 *result = (uint32) res;
488 return false;
489#endif
490}
#define PG_UINT32_MAX
Definition: c.h:561

References a, b, and PG_UINT32_MAX.

◆ pg_mul_u64_overflow()

static bool pg_mul_u64_overflow ( uint64  a,
uint64  b,
uint64 result 
)
inlinestatic

Definition at line 548 of file int.h.

549{
550#if defined(HAVE__BUILTIN_OP_OVERFLOW)
551 return __builtin_mul_overflow(a, b, result);
552#elif defined(HAVE_INT128)
553 uint128 res = (uint128) a * (uint128) b;
554
555 if (res > PG_UINT64_MAX)
556 {
557 *result = 0x5EED; /* to avoid spurious warnings */
558 return true;
559 }
560 *result = (uint64) res;
561 return false;
562#else
563 uint64 res = a * b;
564
565 if (a != 0 && b != res / a)
566 {
567 *result = 0x5EED; /* to avoid spurious warnings */
568 return true;
569 }
570 *result = res;
571 return false;
572#endif
573}
#define PG_UINT64_MAX
Definition: c.h:564

References a, b, and PG_UINT64_MAX.

Referenced by basic_archive_file(), and numericvar_to_uint64().

◆ pg_neg_s16_overflow()

static bool pg_neg_s16_overflow ( int16  a,
int16 result 
)
inlinestatic

Definition at line 121 of file int.h.

122{
123#if defined(HAVE__BUILTIN_OP_OVERFLOW)
124 return __builtin_sub_overflow(0, a, result);
125#else
126 if (unlikely(a == PG_INT16_MIN))
127 {
128 *result = 0x5EED; /* to avoid spurious warnings */
129 return true;
130 }
131 *result = -a;
132 return false;
133#endif
134}

References a, PG_INT16_MIN, and unlikely.

◆ pg_neg_s32_overflow()

static bool pg_neg_s32_overflow ( int32  a,
int32 result 
)
inlinestatic

Definition at line 205 of file int.h.

206{
207#if defined(HAVE__BUILTIN_OP_OVERFLOW)
208 return __builtin_sub_overflow(0, a, result);
209#else
210 if (unlikely(a == PG_INT32_MIN))
211 {
212 *result = 0x5EED; /* to avoid spurious warnings */
213 return true;
214 }
215 *result = -a;
216 return false;
217#endif
218}

References a, PG_INT32_MIN, and unlikely.

Referenced by make_date().

◆ pg_neg_s64_overflow()

static bool pg_neg_s64_overflow ( int64  a,
int64 result 
)
inlinestatic

Definition at line 336 of file int.h.

337{
338#if defined(HAVE__BUILTIN_OP_OVERFLOW)
339 return __builtin_sub_overflow(0, a, result);
340#else
341 if (unlikely(a == PG_INT64_MIN))
342 {
343 *result = 0x5EED; /* to avoid spurious warnings */
344 return true;
345 }
346 *result = -a;
347 return false;
348#endif
349}

References a, PG_INT64_MIN, and unlikely.

◆ pg_neg_u16_overflow()

static bool pg_neg_u16_overflow ( uint16  a,
int16 result 
)
inlinestatic

Definition at line 420 of file int.h.

421{
422#if defined(HAVE__BUILTIN_OP_OVERFLOW)
423 return __builtin_sub_overflow(0, a, result);
424#else
425 int32 res = -((int32) a);
426
427 if (unlikely(res < PG_INT16_MIN))
428 {
429 *result = 0x5EED; /* to avoid spurious warnings */
430 return true;
431 }
432 *result = res;
433 return false;
434#endif
435}

References a, PG_INT16_MIN, and unlikely.

Referenced by pg_strtoint16_safe().

◆ pg_neg_u32_overflow()

static bool pg_neg_u32_overflow ( uint32  a,
int32 result 
)
inlinestatic

Definition at line 493 of file int.h.

494{
495#if defined(HAVE__BUILTIN_OP_OVERFLOW)
496 return __builtin_sub_overflow(0, a, result);
497#else
498 int64 res = -((int64) a);
499
500 if (unlikely(res < PG_INT32_MIN))
501 {
502 *result = 0x5EED; /* to avoid spurious warnings */
503 return true;
504 }
505 *result = res;
506 return false;
507#endif
508}

References a, PG_INT32_MIN, and unlikely.

Referenced by pg_strtoint32_safe().

◆ pg_neg_u64_overflow()

static bool pg_neg_u64_overflow ( uint64  a,
int64 result 
)
inlinestatic

Definition at line 576 of file int.h.

577{
578#if defined(HAVE__BUILTIN_OP_OVERFLOW)
579 return __builtin_sub_overflow(0, a, result);
580#elif defined(HAVE_INT128)
581 int128 res = -((int128) a);
582
583 if (unlikely(res < PG_INT64_MIN))
584 {
585 *result = 0x5EED; /* to avoid spurious warnings */
586 return true;
587 }
588 *result = res;
589 return false;
590#else
591 if (unlikely(a > (uint64) PG_INT64_MAX + 1))
592 {
593 *result = 0x5EED; /* to avoid spurious warnings */
594 return true;
595 }
596 if (unlikely(a == (uint64) PG_INT64_MAX + 1))
597 *result = PG_INT64_MIN;
598 else
599 *result = -((int64) a);
600 return false;
601#endif
602}

References a, PG_INT64_MAX, PG_INT64_MIN, and unlikely.

Referenced by pg_strtoint64_safe().

◆ pg_sub_s16_overflow()

static bool pg_sub_s16_overflow ( int16  a,
int16  b,
int16 result 
)
inlinestatic

Definition at line 85 of file int.h.

86{
87#if defined(HAVE__BUILTIN_OP_OVERFLOW)
88 return __builtin_sub_overflow(a, b, result);
89#else
90 int32 res = (int32) a - (int32) b;
91
92 if (res > PG_INT16_MAX || res < PG_INT16_MIN)
93 {
94 *result = 0x5EED; /* to avoid spurious warnings */
95 return true;
96 }
97 *result = (int16) res;
98 return false;
99#endif
100}

References a, b, PG_INT16_MAX, and PG_INT16_MIN.

Referenced by int2_dist(), and int2mi().

◆ pg_sub_s32_overflow()

static bool pg_sub_s32_overflow ( int32  a,
int32  b,
int32 result 
)
inlinestatic

Definition at line 169 of file int.h.

170{
171#if defined(HAVE__BUILTIN_OP_OVERFLOW)
172 return __builtin_sub_overflow(a, b, result);
173#else
174 int64 res = (int64) a - (int64) b;
175
176 if (res > PG_INT32_MAX || res < PG_INT32_MIN)
177 {
178 *result = 0x5EED; /* to avoid spurious warnings */
179 return true;
180 }
181 *result = (int32) res;
182 return false;
183#endif
184}

References a, b, PG_INT32_MAX, and PG_INT32_MIN.

Referenced by array_prepend(), array_set_element(), array_set_element_expanded(), array_set_slice(), do_to_timestamp(), finite_interval_mi(), int24mi(), int42mi(), int4_dist(), int4mi(), interval_um_internal(), and ReadArrayDimensions().

◆ pg_sub_s64_overflow()

static bool pg_sub_s64_overflow ( int64  a,
int64  b,
int64 result 
)
inlinestatic

Definition at line 262 of file int.h.

263{
264#if defined(HAVE__BUILTIN_OP_OVERFLOW)
265 return __builtin_sub_overflow(a, b, result);
266#elif defined(HAVE_INT128)
267 int128 res = (int128) a - (int128) b;
268
269 if (res > PG_INT64_MAX || res < PG_INT64_MIN)
270 {
271 *result = 0x5EED; /* to avoid spurious warnings */
272 return true;
273 }
274 *result = (int64) res;
275 return false;
276#else
277 /*
278 * Note: overflow is also possible when a == 0 and b < 0 (specifically,
279 * when b == PG_INT64_MIN).
280 */
281 if ((a < 0 && b > 0 && a < PG_INT64_MIN + b) ||
282 (a >= 0 && b < 0 && a > PG_INT64_MAX + b))
283 {
284 *result = 0x5EED; /* to avoid spurious warnings */
285 return true;
286 }
287 *result = a - b;
288 return false;
289#endif
290}

References a, b, PG_INT64_MAX, and PG_INT64_MIN.

Referenced by AdjustIntervalForTypmod(), cash_dist(), cash_in(), cash_mi_cash(), evalStandardFunc(), finite_interval_mi(), generate_series_timestamp_support(), int28mi(), int48mi(), int82mi(), int84mi(), int8_dist(), int8dec(), int8mi(), interval_um_internal(), numericvar_to_int64(), strtoint64(), timestamp_bin(), timestamp_mi(), TimestampDifferenceMilliseconds(), and timestamptz_bin().

◆ pg_sub_u16_overflow()

static bool pg_sub_u16_overflow ( uint16  a,
uint16  b,
uint16 result 
)
inlinestatic

Definition at line 386 of file int.h.

387{
388#if defined(HAVE__BUILTIN_OP_OVERFLOW)
389 return __builtin_sub_overflow(a, b, result);
390#else
391 if (b > a)
392 {
393 *result = 0x5EED; /* to avoid spurious warnings */
394 return true;
395 }
396 *result = a - b;
397 return false;
398#endif
399}

References a, and b.

◆ pg_sub_u32_overflow()

static bool pg_sub_u32_overflow ( uint32  a,
uint32  b,
uint32 result 
)
inlinestatic

Definition at line 459 of file int.h.

460{
461#if defined(HAVE__BUILTIN_OP_OVERFLOW)
462 return __builtin_sub_overflow(a, b, result);
463#else
464 if (b > a)
465 {
466 *result = 0x5EED; /* to avoid spurious warnings */
467 return true;
468 }
469 *result = a - b;
470 return false;
471#endif
472}

References a, and b.

◆ pg_sub_u64_overflow()

static bool pg_sub_u64_overflow ( uint64  a,
uint64  b,
uint64 result 
)
inlinestatic

Definition at line 532 of file int.h.

533{
534#if defined(HAVE__BUILTIN_OP_OVERFLOW)
535 return __builtin_sub_overflow(a, b, result);
536#else
537 if (b > a)
538 {
539 *result = 0x5EED; /* to avoid spurious warnings */
540 return true;
541 }
542 *result = a - b;
543 return false;
544#endif
545}

References a, and b.