summaryrefslogtreecommitdiffstats
path: root/mpi-patches/add-bitops
Commit message (Collapse)AuthorAgeFilesLines
* * 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.