Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
#line 2 "../src/kernel/none/addll.h"1/* Copyright (C) 2003 The PARI group.23This file is part of the PARI/GP package.45PARI/GP is free software; you can redistribute it and/or modify it under the6terms of the GNU General Public License as published by the Free Software7Foundation; either version 2 of the License, or (at your option) any later8version. It is distributed in the hope that it will be useful, but WITHOUT9ANY WARRANTY WHATSOEVER.1011Check the License for details. You should have received a copy of it, along12with the package; see the file 'COPYING'. If not, write to the Free Software13Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */1415/* This file originally adapted from gmp-3.1.1 (from T. Granlund), files16* longlong.h and gmp-impl.h1718Copyright (C) 2000 Free Software Foundation, Inc. */1920#undef LOCAL_OVERFLOW21#define LOCAL_OVERFLOW22extern ulong overflow;2324#if !defined(INLINE)25extern long addll(ulong x, ulong y);26extern long addllx(ulong x, ulong y);27extern long subll(ulong x, ulong y);28extern long subllx(ulong x, ulong y);29#else3031#if defined(__GNUC__) && !defined(DISABLE_INLINE)32#undef LOCAL_OVERFLOW33#define LOCAL_OVERFLOW register ulong overflow3435#define addll(a, b) \36__extension__ ({ \37ulong __arg1 = (a), __arg2 = (b), __value = __arg1 + __arg2; \38overflow = (__value < __arg1); \39__value; \40})4142#define addllx(a, b) \43__extension__ ({ \44ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 + overflow;\45overflow = (__tmp < __arg1); \46__value = __tmp + __arg2; \47overflow |= (__value < __tmp); \48__value; \49})5051#define subll(a, b) \52__extension__ ({ \53ulong __arg1 = (a), __arg2 = (b); \54overflow = (__arg2 > __arg1); \55__arg1 - __arg2; \56})5758#define subllx(a, b) \59__extension__ ({ \60ulong __arg1 = (a), __arg2 = (b), __value, __tmp = __arg1 - overflow;\61overflow = (__arg1 < overflow); \62__value = __tmp - __arg2; \63overflow |= (__arg2 > __tmp); \64__value; \65})6667#else /* __GNUC__ */6869INLINE long70addll(ulong x, ulong y)71{72const ulong z = x+y;73overflow=(z<x);74return (long) z;75}7677INLINE long78addllx(ulong x, ulong y)79{80const ulong z = x+y+overflow;81overflow = (z<x || (z==x && overflow));82return (long) z;83}8485INLINE long86subll(ulong x, ulong y)87{88const ulong z = x-y;89overflow = (z>x);90return (long) z;91}9293INLINE long94subllx(ulong x, ulong y)95{96const ulong z = x-y-overflow;97overflow = (z>x || (z==x && overflow));98return (long) z;99}100101#endif /* __GNUC__ */102103#endif104105106