Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gdtoa Avoid unportable left shift construct



details:   https://anonhg.NetBSD.org/src/rev/b944ddcf80b2
branches:  trunk
changeset: 745039:b944ddcf80b2
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Feb 22 00:38:14 2020 +0000

description:
Avoid unportable left shift construct

left shift of 9 by 28 places cannot be represented in type 'int'

diffstat:

 lib/libc/gdtoa/gethex.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 7bb3149312b8 -r b944ddcf80b2 lib/libc/gdtoa/gethex.c
--- a/lib/libc/gdtoa/gethex.c   Sat Feb 22 00:32:08 2020 +0000
+++ b/lib/libc/gdtoa/gethex.c   Sat Feb 22 00:38:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethex.c,v 1.6 2013/04/19 10:41:53 joerg Exp $ */
+/* $NetBSD: gethex.c,v 1.7 2020/02/22 00:38:14 kamil Exp $ */
 
 /****************************************************************
 
@@ -209,7 +209,7 @@
                        L = 0;
                        n = 0;
                        }
-               L |= (hexdig[(unsigned char)*s1] & 0x0f) << n;
+               L |= (unsigned int)(hexdig[(unsigned char)*s1] & 0x0f) << n;
                n += 4;
                }
        *x++ = L;



Home | Main Index | Thread Index | Old Index