summaryrefslogtreecommitdiff
path: root/lib/libc/quad/ashldi3.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-04-27 17:46:48 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-04-27 17:46:48 +0000
commit4d4116761958b945bbc20fb5a5495c1cc7a897c0 (patch)
tree177e88316908c6c765dd3bde9ab4ac7cfb5a73b7 /lib/libc/quad/ashldi3.c
parent3fd98b3b1027bc45b04855550bc44e05c0a9e95d (diff)
A quad is two ints, not two longs. Also fix some problems with
conversions from floating point to quad. Problem reported by Marcus Holland-Moritz. From NetBSD. ok millert@
Diffstat (limited to 'lib/libc/quad/ashldi3.c')
-rw-r--r--lib/libc/quad/ashldi3.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libc/quad/ashldi3.c b/lib/libc/quad/ashldi3.c
index efea0f35ba7..8a1335a35a0 100644
--- a/lib/libc/quad/ashldi3.c
+++ b/lib/libc/quad/ashldi3.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: ashldi3.c,v 1.3 2003/06/02 20:18:36 millert Exp $";
+static char rcsid[] = "$OpenBSD: ashldi3.c,v 1.4 2004/04/27 17:46:46 otto Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -48,14 +48,15 @@ __ashldi3(a, shift)
{
union uu aa;
+ if (shift == 0)
+ return(a);
aa.q = a;
- if (shift >= LONG_BITS) {
- aa.ul[H] = shift >= QUAD_BITS ? 0 :
- aa.ul[L] << (shift - LONG_BITS);
+ if (shift >= INT_BITS) {
+ aa.ul[H] = aa.ul[L] << (shift - INT_BITS);
aa.ul[L] = 0;
- } else if (shift > 0) {
+ } else {
aa.ul[H] = (aa.ul[H] << shift) |
- (aa.ul[L] >> (LONG_BITS - shift));
+ (aa.ul[L] >> (INT_BITS - shift));
aa.ul[L] <<= shift;
}
return (aa.q);