summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorBo Lindbergh <blgl@stacken.kth.se>2010-07-05 01:31:01 +0200
committerDavid Golden <dagolden@cpan.org>2010-07-06 08:01:47 -0400
commita674e8db187f4e33b2e6b9341cc0e30fbcf75bd2 (patch)
tree2d8b986c47f3f1b308aaf815684f073e049ab0f3 /numeric.c
parent333f87f24de2f15740185612410ef911ccfed6a3 (diff)
downloadperl-a674e8db187f4e33b2e6b9341cc0e30fbcf75bd2.tar.gz
Code for allowing uppercase X/B in hexadecimal/binary numbers (#76296).
Signed-off-by: David Golden <dagolden@cpan.org>
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/numeric.c b/numeric.c
index b116376916..e7e740f81e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -153,11 +153,11 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
for compatibility silently suffer "b" and "0b" as valid binary
numbers. */
if (len >= 1) {
- if (s[0] == 'b') {
+ if (s[0] == 'b' || s[0] == 'B') {
s++;
len--;
}
- else if (len >= 2 && s[0] == '0' && s[1] == 'b') {
+ else if (len >= 2 && s[0] == '0' && (s[1] == 'b' || s[1] == 'B')) {
s+=2;
len-=2;
}
@@ -269,11 +269,11 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
for compatibility silently suffer "x" and "0x" as valid hex numbers.
*/
if (len >= 1) {
- if (s[0] == 'x') {
+ if (s[0] == 'x' || s[0] == 'X') {
s++;
len--;
}
- else if (len >= 2 && s[0] == '0' && s[1] == 'x') {
+ else if (len >= 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) {
s+=2;
len-=2;
}