Hash :
b432845c
Author :
Thomas de Grivel
Date :
2025-08-03T12:56:00
dereference arguments to inspect for numeric types
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
/* kc3
* Copyright from 2022 to 2025 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
/* Gen from buf_inspect_u_base.c.in BITS=8 bits=8 BASE=binary */
#include "assert.h"
#include "buf.h"
#include "buf_inspect.h"
#include "kc3_main.h"
sw buf_inspect_u8_binary (s_buf *buf, u8 u)
{
return buf_inspect_u8_base
(buf, &g_kc3_base_binary, u);
}
u8 buf_inspect_u8_binary_digits (u8 x)
{
return buf_inspect_u8_base_digits
(&g_kc3_base_binary, x);
}
sw buf_inspect_u8_binary_pad (s_buf *buf, u8 size, character pad,
u8 x)
{
u8 digits;
u8 i;
sw r;
sw result = 0;
assert(buf);
assert(size);
digits = buf_inspect_u8_binary_digits(x);
i = digits;
while (i < size) {
if ((r = buf_write_character_utf8(buf, pad)) <= 0)
return r;
result += r;
i++;
}
if ((r = buf_inspect_u8_binary(buf, x)) <= 0)
return r;
result += r;
assert(size == result);
return result;
}
sw buf_inspect_u8_binary_size (s_pretty *pretty, u8 x)
{
return buf_inspect_u8_base_size(pretty, &g_kc3_base_binary,
x);
}