diff options
author | Mike Pall <mike> | 2011-01-26 21:46:02 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-26 21:46:02 +0100 |
commit | 3184f1716925f96b3d56c2795a0769bb3463f54e (patch) | |
tree | c9364c781e88b321ac4caffa566ccb5fa6659f83 /src/lj_cdata.c | |
parent | 2526498c7126f3e60d1f3a8d72c97bf20bf4a49e (diff) | |
download | luajit2-3184f1716925f96b3d56c2795a0769bb3463f54e.tar.gz |
FFI: Move code for cdata arithmetic to lj_carith.c.
Diffstat (limited to 'src/lj_cdata.c')
-rw-r--r-- | src/lj_cdata.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c index 9033d492..a3257249 100644 --- a/src/lj_cdata.c +++ b/src/lj_cdata.c @@ -251,38 +251,4 @@ void lj_cdata_set(CTState *cts, CType *d, uint8_t *dp, TValue *o, CTInfo qual) lj_cconv_ct_tv(cts, d, dp, o, 0); } -/* -- 64 bit integer arithmetic helpers ----------------------------------- */ - -/* 64 bit integer x^k. */ -uint64_t lj_cdata_powi64(uint64_t x, uint64_t k, int isunsigned) -{ - uint64_t y = 0; - if (k == 0) - return 1; - if (!isunsigned) { - if ((int64_t)k < 0) { - if (x == 0) - return U64x(7fffffff,ffffffff); - else if (x == 1) - return 1; - else if ((int64_t)x == -1) - return (k & 1) ? -1 : 1; - else - return 0; - } - } - for (; (k & 1) == 0; k >>= 1) x *= x; - y = x; - if ((k >>= 1) != 0) { - for (;;) { - x *= x; - if (k == 1) break; - if (k & 1) y *= x; - k >>= 1; - } - y *= x; - } - return y; -} - #endif |