root/src/dps8/dps8_math128.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * vim: filetype=c:tabstop=4:ai:expandtab
   3  * SPDX-License-Identifier: ICU
   4  * scspell-id: 987c49d9-f62e-11ec-a5f4-80ee73e9b8e7
   5  *
   6  * ---------------------------------------------------------------------------
   7  *
   8  * Copyright (c) 2016 Jean-Michel Merliot
   9  * Copyright (c) 2021-2024 The DPS8M Development Team
  10  *
  11  * This software is made available under the terms of the ICU License.
  12  * See the LICENSE.md file at the top-level directory of this distribution.
  13  *
  14  * ---------------------------------------------------------------------------
  15  */
  16 
  17 /*
  18  * 128-bit integer support
  19  */
  20 
  21 #if defined(NEED_128)
  22 
  23 # define cast_128(x) construct_128 ((uint64_t) (x).h, (x).l)
  24 # define cast_s128(x) construct_s128 ((int64_t) (x).h, (x).l)
  25 
  26 int test_math128(void);
  27 bool iszero_128 (uint128 w);
  28 bool isnonzero_128 (uint128 w);
  29 bool iseq_128 (uint128 a, uint128 b);
  30 bool isgt_128 (uint128 a, uint128 b);
  31 bool islt_128 (uint128 a, uint128 b);
  32 bool isge_128 (uint128 a, uint128 b);
  33 bool islt_s128 (int128 a, int128 b);
  34 bool isgt_s128 (int128 a, int128 b);
  35 uint128 and_128 (uint128 a, uint128 b);
  36 int128 and_s128 (int128 a, uint128 b);
  37 uint128 or_128 (uint128 a, uint128 b);
  38 uint128 xor_128 (uint128 a, uint128 b);
  39 uint128 add_128 (uint128 a, uint128 b);
  40 uint128 subtract_128 (uint128 a, uint128 b);
  41 uint128 multiply_128 (uint128 a, uint128 b);
  42 int128 multiply_s128 (int128 a, int128 b);
  43 uint128 divide_128_16 (uint128 a, uint16_t b, uint16_t * rem);
  44 uint128 divide_128_32 (uint128 a, uint32_t b, uint32_t * rem);
  45 uint128 divide_128 (uint128 a, uint128 b, uint128 * rem);
  46 uint128 complement_128 (uint128 a);
  47 uint128 negate_128 (uint128 a);
  48 int128 negate_s128 (int128 a);
  49 uint128 lshift_128 (uint128 a, unsigned int n);
  50 int128 lshift_s128 (int128 a, unsigned int n);
  51 uint128 rshift_128 (uint128 a, unsigned int n);
  52 int128 rshift_s128 (int128 a, unsigned int n);
  53 #else
  54 
  55 # if (__SIZEOF_LONG__ < 8) && ( !defined(__MINGW64__) || !defined(__MINGW32__) )
  56 
  57 typedef          int TItype     __attribute__ ((mode (TI)));
  58 typedef unsigned int UTItype    __attribute__ ((mode (TI)));
  59 
  60 typedef TItype __int128_t;
  61 typedef UTItype __uint128_t;
  62 
  63 # endif
  64 #endif

/* [previous][next][first][last][top][bottom][index][help] */