Turns out that implementing a cyclically wrapping domain properly is much more tricky than initially anticipated. After initial analysis I decided where to draw the line and what ''esoteric features'' aspects to leave out. Then I used Knowledge-Technology (Claude) to scrutinise and improve my implementation, and to learn a lot more about integral arithmetics in general.
41 lines
969 B
C++
41 lines
969 B
C++
/*
|
||
INTEGRAL.hpp - there is nothing like one
|
||
|
||
Copyright (C)
|
||
2024, Hermann Vosseler <Ichthyostega@web.de>
|
||
|
||
**Lumiera** is free software; you can redistribute it and/or modify it
|
||
under the terms of the GNU General Public License as published by the
|
||
Free Software Foundation; either version 2 of the License, or (at your
|
||
option) any later version. See the file COPYING for further details.
|
||
|
||
*/
|
||
|
||
|
||
/** @file integral.hpp
|
||
** Inclusion for common place integral types and constants.
|
||
*/
|
||
|
||
|
||
|
||
#ifndef LIB_INTEGRAL_H
|
||
#define LIB_INTEGRAL_H
|
||
|
||
#include <cstddef>
|
||
#include <cstdint>
|
||
|
||
/* === minimal common place === */
|
||
using uint = unsigned int;
|
||
using uchar = unsigned char;
|
||
using ulong = unsigned long int;
|
||
using llong = long long int;
|
||
using ullong = unsigned long long int;
|
||
using ushort = unsigned short int;
|
||
|
||
using f128 = long double;
|
||
static_assert(10 <= sizeof(f128));
|
||
|
||
const uint LIFE_AND_UNIVERSE_4EVER = 42;
|
||
|
||
|
||
#endif /*LIB_INTEGRAL_H*/
|