/* Copyright (c) 2026 Jakub Juszczakiewicz
 * All rights reserved.
 */

#pragma once

#include <stdint.h>
#include <stddef.h>

typedef union
{
  struct {
#ifdef BIG_ENDIAN
    uint32_t u32a, u32b, u32c, u32d;
#else
    uint32_t u32d, u32c, u32b, u32a;
#endif
  };
  struct {
#ifdef BIG_ENDIAN
    uint64_t u64a, u64b;
#else
    uint64_t u64b, u64a;
#endif
  };
#ifdef HAVE_INT128
    unsigned __int128 u128;
#endif
} uint128_t;

size_t logA(uint128_t a);
void uint128_export_dec_str(char * out, const uint128_t * in);
void uint128_inc_u64(uint128_t * acc, uint64_t b);
