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-2022 The DPS8M Development Team
  10  *
  11  * All rights reserved.
  12  *
  13  * This software is made available under the terms of the ICU
  14  * License, version 1.8.1 or later.  For more details, see the
  15  * LICENSE.md file at the top-level directory of this distribution.
  16  *
  17  * ---------------------------------------------------------------------------
  18  */
  19 
  20 /*
  21  * 128-bit integer support
  22  */
  23 
  24 #ifdef NEED_128
  25 
  26 # define cast_128(x) construct_128 ((uint64_t) (x).h, (x).l)
  27 # define cast_s128(x) construct_s128 ((int64_t) (x).h, (x).l)
  28 
  29 int test_math128(void);
  30 bool iszero_128 (uint128 w);
  31 bool isnonzero_128 (uint128 w);
  32 bool iseq_128 (uint128 a, uint128 b);
  33 bool isgt_128 (uint128 a, uint128 b);
  34 bool islt_128 (uint128 a, uint128 b);
  35 bool isge_128 (uint128 a, uint128 b);
  36 bool islt_s128 (int128 a, int128 b);
  37 bool isgt_s128 (int128 a, int128 b);
  38 uint128 and_128 (uint128 a, uint128 b);
  39 int128 and_s128 (int128 a, uint128 b);
  40 uint128 or_128 (uint128 a, uint128 b);
  41 uint128 xor_128 (uint128 a, uint128 b);
  42 uint128 add_128 (uint128 a, uint128 b);
  43 uint128 subtract_128 (uint128 a, uint128 b);
  44 uint128 multiply_128 (uint128 a, uint128 b);
  45 int128 multiply_s128 (int128 a, int128 b);
  46 uint128 divide_128_16 (uint128 a, uint16_t b, uint16_t * rem);
  47 uint128 divide_128_32 (uint128 a, uint32_t b, uint32_t * rem);
  48 uint128 divide_128 (uint128 a, uint128 b, uint128 * rem);
  49 uint128 complement_128 (uint128 a);
  50 uint128 negate_128 (uint128 a);
  51 int128 negate_s128 (int128 a);
  52 uint128 lshift_128 (uint128 a, unsigned int n);
  53 int128 lshift_s128 (int128 a, unsigned int n);
  54 uint128 rshift_128 (uint128 a, unsigned int n);
  55 int128 rshift_s128 (int128 a, unsigned int n);
  56 #else
  57 
  58 # if (__SIZEOF_LONG__ < 8) && ( !defined(__MINGW64__) || !defined(__MINGW32__) )
  59 
  60 typedef          int TItype     __attribute__ ((mode (TI)));
  61 typedef unsigned int UTItype    __attribute__ ((mode (TI)));
  62 
  63 typedef TItype __int128_t;
  64 typedef UTItype __uint128_t;
  65 
  66 # endif
  67 #endif

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