[pypy-commit] pypy default: Fix broken parsing logic
arigo
pypy.commits at gmail.com
Mon Mar 28 09:20:05 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r83411:f5820433cbf9
Date: 2016-03-28 15:19 +0200
http://bitbucket.org/pypy/pypy/changeset/f5820433cbf9/
Log: Fix broken parsing logic
diff --git a/rpython/jit/backend/arm/detect.py b/rpython/jit/backend/arm/detect.py
--- a/rpython/jit/backend/arm/detect.py
+++ b/rpython/jit/backend/arm/detect.py
@@ -78,28 +78,25 @@
finally:
os.close(fd)
+ # decode chunks of 8 bytes (a_type, a_val), and
+ # return the a_val whose a_type corresponds to type_,
+ # or zero if not found.
i = 0
while i <= buf_size - struct_size:
- if buf[i] == '\x00':
- i += 1
- continue
-
# We only support little-endian ARM
a_type = (ord(buf[i]) |
(ord(buf[i+1]) << 8) |
(ord(buf[i+2]) << 16) |
(ord(buf[i+3]) << 24))
-
- if a_type != type_:
- i += struct_size
-
a_val = (ord(buf[i+4]) |
(ord(buf[i+5]) << 8) |
(ord(buf[i+6]) << 16) |
(ord(buf[i+7]) << 24))
- return a_val
+ i += struct_size
+ if a_type == type_:
+ return a_val
- raise KeyError('failed to find auxval type: %d' % type_)
+ return 0
def detect_neon():
More information about the pypy-commit
mailing list