Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
294 BITOP (^, "bitxor"); | 294 BITOP (^, "bitxor"); |
295 } | 295 } |
296 | 296 |
297 static int64_t | 297 static int64_t |
298 bitshift (double a, int n, int64_t mask) | 298 bitshift (double a, int n, int64_t mask) |
299 { | |
300 // In the name of bug-for-bug compatibility. | |
301 if (a < 0) | |
302 return -bitshift (-a, n, mask); | |
303 | |
304 if (n > 0) | |
305 return (static_cast<int64_t> (a) << n) & mask; | |
306 else if (n < 0) | |
307 return (static_cast<int64_t> (a) >> -n) & mask; | |
308 else | |
309 return static_cast<int64_t> (a) & mask; | |
310 } | |
311 | |
312 static int64_t | |
313 bitshift (float a, int n, int64_t mask) | |
299 { | 314 { |
300 // In the name of bug-for-bug compatibility. | 315 // In the name of bug-for-bug compatibility. |
301 if (a < 0) | 316 if (a < 0) |
302 return -bitshift (-a, n, mask); | 317 return -bitshift (-a, n, mask); |
303 | 318 |