summaryrefslogtreecommitdiffstats
path: root/mpi-patches/add-bitops
Commit message (Collapse)AuthorAgeFilesLines
* * Makefile (CFLAGS): Removed puzzling, unnecessary definitionsKaz Kylheku2015-02-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of XMALLOC, XCALLOC, XREALLOC and XFREE for $(MPI_OBJS). MPI does not use such macros and the allocator is already retargetted to use the TXR one. * mpi-patches/use-txr-allocator: In this patch, we don't need external declaration for chk_malloc or chk_realloc because they are not used. Only chk_calloc is used. * mpi-patches/add-bitops: Refreshed. * mpi-patches/add-mp-hash: Likewise. * mpi-patches/add-mp-set-intptr: Likewise. * mpi-patches/add-mpi-toradix-with-case: Likewise. * mpi-patches/bit-search-optimizations: Likewise. * mpi-patches/export-mp-eq: Likewise. * mpi-patches/faster-square-root: Likewise. * mpi-patches/fix-bad-shifts: Likewise. * mpi-patches/fix-ctype-warnings: Likewise. * mpi-patches/fix-mult-bug: Likewise. * mpi-patches/mpi-set-double-intptr: Likewise. * mpi-patches/mpi-set-mpi-word: Likewise. * mpi-patches/mpi-to-double: Likewise.
* * arith.c (bit): New function.Kaz Kylheku2014-06-281-4/+24
| | | | | | | | | | * eval.c (eval_init): Register bit as intrinsic. * lib.h (bit): Declared. * mpi-patches/add-bitops (mp_bit): New function. * txr.1: Documented bit
* * mpi-patches/add-bitops (mp_and, mp_or, mp_xor, mp_shift): Plug memoryKaz Kylheku2014-06-281-38/+35
| | | | | | | leaks caused by wrongly initializing the temporary destination operand for mp2_comp with a size, which mp2_comp then clobbers by doing the same thing. Also plug memory leaks that happen in in out-of-memory return case.
* Fixes to bignum bit operations affecting pretty much all bit operationsKaz Kylheku2014-06-261-7/+7
| | | | | | | | | | | | | | when bit field operands are negative, affecting logand, logor, logxor, lognot, logtrunc, logtest and ash. In addition, logtest was found to return the logical inverse of its correct value. * arith.c (logtest): Fix broken boolean polarity of return value. * mpi-patches/add-bitops (mp_2comp): Fix incorrect treatment of negative values. (mp_and): Fix incorrectly ordered statements, which cause failure when operands are negative.
* * mpi-patches/faster-square-root (mp_sqrt): Bugfix: was computing squareKaz Kylheku2014-02-191-5/+5
| | | | | | | | | | | | | roots that were incorrect in the last digit/bit, because it was not generating the guess mask all the way down to bit zero. Also, added an early test to bail the loop when an the guess at the root happens to be right. * mpi-patches/add-bitops: Refreshed. * mpi-patches/fix-ctype-warnings: Likewise. * mpi-patches/mpi-to-double: Likewise.
* * arith.c (highest_significant_bit): New static function.Kaz Kylheku2012-09-171-7/+110
| | | | | | | | | | | | | | | | (comp_clamp): Bugfix: avoid shifting left into sign bit. Function renamed to comp_trunc. (logtrunc, ash): New functions. * eval.c (eval_init): Registered logtrunc and ash intrinsics. * lib.h (logtrunc, ash): Declared. * mpi-patches/add-bitops (s_highest_bit_mp): Forward declaration for added. (mp_clamp_comp): Bugfix in handling remainder bits. Function renamed to mp_trunc_comp. (mp_trunc, mp_shift): New functions.
* * mpi-patches/add-bitops: Bugfixes: mp_2comp is extended to properlyKaz Kylheku2012-09-161-13/+17
| | | | | | | | allow arbitrarily wide complements (which causes the code to access beyond the a argument's digits array). A similar fix is applied in the new mp_clamp_comp function. Incorrect initializations of mp_int fixed in all the logic functions: mp_init was used instead of mp_init_size.
* * arith.c (logand, logior, logxor): Bugfix: result needs to beKaz Kylheku2012-09-161-4/+47
| | | | | | | | | | | | | | normalized, otherwise we end up with fixnum-range bignums. (comp_clamp): New function. (logcomp): Changed to two argument form. If second argument is present (not nil) then call comp_clamp. * eval.c (eval_init): Change registration of logcomp to allow optional argument. * lib.h (logcomp): Declaration updated. * mpi-patches/add-bitops: New mp_clamp_comp function implemented.
* Adding complementing function.Kaz Kylheku2012-09-161-7/+51
| | | | | | | | | | * arith.c (logcomp): New function. * eval.c (eval_init): logcomp registered as intrinsic. * lib.h (logcomp) declared. * mpi-patches/add-bitops: Fixed bugs in mp_xor. Implemented mp_comp.
* Starting work on adding bit operations. The semantics is thatKaz Kylheku2012-09-161-0/+273
negative integers behave as an "infinite bit two's complement". * arith.c (logand, logor, logxor): New functions. * eval.c (eval_init): New intrinsic functions logand, logior, logxor. * lib.h (logand, logor, logxor): Declared. * mpi-patches/series: New patch, add-bitops. * mpi-patches/add-bitops: New file.