Mercurial > hg > octave-nkf
diff src/bitfcns.cc @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | 0c6b4c7d7117 |
children | b93ac0586e4b |
line wrap: on
line diff
--- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -309,6 +309,21 @@ return static_cast<int64_t> (a) & mask; } +static int64_t +bitshift (float a, int n, int64_t mask) +{ + // In the name of bug-for-bug compatibility. + if (a < 0) + return -bitshift (-a, n, mask); + + if (n > 0) + return (static_cast<int64_t> (a) << n) & mask; + else if (n < 0) + return (static_cast<int64_t> (a) >> -n) & mask; + else + return static_cast<int64_t> (a) & mask; +} + // Note that the bitshift operators are undefined if shifted by more // bits than in the type, so we need to test for the size of the // shift.