Branch data Line data Source code
1 : : // Copyright 2026 David Robillard <d@drobilla.net> 2 : : // SPDX-License-Identifier: ISC 3 : : 4 : : #include "fixed.h" 5 : : #include "result.h" 6 : : 7 : : #include <exess/exess.h> 8 : : 9 : : #include <stdint.h> 10 : : 11 : : EXESS_NONBLOCKING ExessResult 12 : 116684 : read_signed(const char* const str, 13 : : const int64_t min, 14 : : const int64_t max, 15 : : int64_t* const out) 16 : : { 17 : 116684 : const ExessResult r = exess_read_long(str, out); 18 : : 19 [ + + + + ]: 116673 : return (!r.status && (*out < min || *out > max)) 20 : 18 : ? RESULT(EXESS_OUT_OF_RANGE, r.count) 21 [ + + ]: 233357 : : r; 22 : : } 23 : : 24 : : EXESS_NONBLOCKING ExessResult 25 : 82755 : read_unsigned(const char* const str, const uint64_t max, uint64_t* const out) 26 : : { 27 : 82755 : const ExessResult r = exess_read_ulong(str, out); 28 : : 29 [ + + + + ]: 82755 : return (!r.status && *out > max) ? RESULT(EXESS_OUT_OF_RANGE, r.count) : r; 30 : : }