summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-03-03 04:35:09 -0500
committerMark H Weaver <mhw@netris.org>2013-03-12 15:39:20 -0400
commite08a12b5356c20ed0418bcaee136eb3632c5616f (patch)
treeac3a759997554ee2889ffa8e0d1a09f6ce3023ee /libguile/numbers.h
parenta285b18ca820e089e2e5d02f8ed07a1e341dffc3 (diff)
downloadguile-e08a12b5356c20ed0418bcaee136eb3632c5616f.tar.gz
Add 'round-ash', a rounding arithmetic shift operator
* libguile/numbers.c (left_shift_exact_integer, floor_right_shift_exact_integer, round_right_shift_exact_integer): New static functions. (scm_round_ash): New procedure. (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and 'floor_right_shift_exact_integer'. * libguile/numbers.h: Add prototype for scm_round_ash. Rename the second argument of 'scm_ash' from 'cnt' to 'count'. * test-suite/tests/numbers.test (round-ash, ash): Add new unified testing framework for 'ash' and 'round-ash'. Previously, the tests for 'ash' were not very comprehensive; for example, they did not include a single test where the number to be shifted was a bignum. * doc/ref/api-data.texi (Bitwise Operations): Add documentation for 'round-ash'. Improve documentation for `ash'.
Diffstat (limited to 'libguile/numbers.h')
-rw-r--r--libguile/numbers.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 2c8b2602e..912f287bb 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -206,7 +206,8 @@ SCM_API SCM scm_logbit_p (SCM n1, SCM n2);
SCM_API SCM scm_lognot (SCM n);
SCM_API SCM scm_modulo_expt (SCM n, SCM k, SCM m);
SCM_API SCM scm_integer_expt (SCM z1, SCM z2);
-SCM_API SCM scm_ash (SCM n, SCM cnt);
+SCM_API SCM scm_ash (SCM n, SCM count);
+SCM_API SCM scm_round_ash (SCM n, SCM count);
SCM_API SCM scm_bit_extract (SCM n, SCM start, SCM end);
SCM_API SCM scm_logcount (SCM n);
SCM_API SCM scm_integer_length (SCM n);