strtouq.c (6c06b4e2aa2a28d1f0bbd29ecdce35aaaf600ce8) | strtouq.c (e7241b8ffe2856c43aa6f2a539534aa99a43e194) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 42 unchanged lines hidden (view full) --- 51u_quad_t 52strtouq(nptr, endptr, base) 53 const char *nptr; 54 char **endptr; 55 register int base; 56{ 57 register const char *s = nptr; 58 register u_quad_t acc; | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 42 unchanged lines hidden (view full) --- 51u_quad_t 52strtouq(nptr, endptr, base) 53 const char *nptr; 54 char **endptr; 55 register int base; 56{ 57 register const char *s = nptr; 58 register u_quad_t acc; |
59 register int c; | 59 register unsigned char c; |
60 register u_quad_t qbase, cutoff; 61 register int neg, any, cutlim; 62 63 /* 64 * See strtoq for comments as to the logic used. 65 */ 66 s = nptr; 67 do { --- 14 unchanged lines hidden (view full) --- 82 base = 16; 83 } 84 if (base == 0) 85 base = c == '0' ? 8 : 10; 86 qbase = (unsigned)base; 87 cutoff = (u_quad_t)UQUAD_MAX / qbase; 88 cutlim = (u_quad_t)UQUAD_MAX % qbase; 89 for (acc = 0, any = 0;; c = *s++) { | 60 register u_quad_t qbase, cutoff; 61 register int neg, any, cutlim; 62 63 /* 64 * See strtoq for comments as to the logic used. 65 */ 66 s = nptr; 67 do { --- 14 unchanged lines hidden (view full) --- 82 base = 16; 83 } 84 if (base == 0) 85 base = c == '0' ? 8 : 10; 86 qbase = (unsigned)base; 87 cutoff = (u_quad_t)UQUAD_MAX / qbase; 88 cutlim = (u_quad_t)UQUAD_MAX % qbase; 89 for (acc = 0, any = 0;; c = *s++) { |
90 if (!isascii(c)) 91 break; |
|
90 if (isdigit(c)) 91 c -= '0'; 92 else if (isalpha(c)) 93 c -= isupper(c) ? 'A' - 10 : 'a' - 10; 94 else 95 break; 96 if (c >= base) 97 break; --- 17 unchanged lines hidden --- | 92 if (isdigit(c)) 93 c -= '0'; 94 else if (isalpha(c)) 95 c -= isupper(c) ? 'A' - 10 : 'a' - 10; 96 else 97 break; 98 if (c >= base) 99 break; --- 17 unchanged lines hidden --- |