diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-05-14 20:20:10 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-05-14 20:20:10 +0200 |
| commit | bc8390c7615cf9a466420aa05130322488d54d7b (patch) | |
| tree | ad22f94e5a1cdc97633656018d6ba5ca68f293e2 /doc | |
| parent | Reorder sections (diff) | |
| download | libzahl-bc8390c7615cf9a466420aa05130322488d54d7b.tar.gz libzahl-bc8390c7615cf9a466420aa05130322488d54d7b.tar.bz2 libzahl-bc8390c7615cf9a466420aa05130322488d54d7b.tar.xz | |
Division is truncated, not floored
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/bit-operations.tex | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/doc/bit-operations.tex b/doc/bit-operations.tex index be9fccb..c7e15c9 100644 --- a/doc/bit-operations.tex +++ b/doc/bit-operations.tex @@ -40,15 +40,14 @@ $r = \phantom{0100}100001_2$ after calling {\tt zrsh(r, a, 2)}. \vspace{1em} {\tt zlsh(r, a, b)} is equivalent to $r \gets a \cdot 2^b$, -and {\tt zrsh(r, a, b)} is equivalent to -$r \gets \lfloor a \div 2^b \rfloor$, {\tt zlsh} and -{\tt zrsh} are significantly faster than {\tt zpowu} -and should be used whenever possible. {\tt zpowu} -does not check if it is possible for it to use {\tt zlsh} -instead, even if it would, {\tt zlsh} and {\tt zrsh} -would still be preferable in most cases because it -removes the need for {\tt zmul} and {\tt zdiv}, -respectively. +and {\tt zrsh(r, a, b)} is equivalent to $r \gets a \div 2^b$, +with truncated division, {\tt zlsh} and {\tt zrsh} are +significantly faster than {\tt zpowu} and should be used +whenever possible. {\tt zpowu} does not check if it is +possible for it to use {\tt zlsh} instead, even if it +would, {\tt zlsh} and {\tt zrsh} would still be preferable +in most cases because it removes the need for {\tt zmul} +and {\tt zdiv}, respectively. {\tt zlsh} and {\tt zrsh} are implemented in two steps: (1) shift whole characters, that is, groups of aligned |
