grpc
third_party
bloaty
third_party
capstone
bindings
python
xprint.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Capstone Python bindings, by Nguyen Anh Quynnh <aquynh@gmail.com>
3
4
from
__future__
import
print_function
5
import
sys
6
_python3 = sys.version_info.major == 3
7
8
9
def
to_hex
(s, prefix_0x = True):
10
if
_python3:
11
if
prefix_0x:
12
return
" "
.join(
"0x{0:02x}"
.
format
(c)
for
c
in
s)
# <-- Python 3 is OK
13
else
:
14
return
" "
.join(
"{0:02x}"
.
format
(c)
for
c
in
s)
# <-- Python 3 is OK
15
else
:
16
if
prefix_0x:
17
return
" "
.join(
"0x{0:02x}"
.
format
(
ord
(c))
for
c
in
s)
18
else
:
19
return
" "
.join(
"{0:02x}"
.
format
(
ord
(c))
for
c
in
s)
20
21
def
to_hex2
(s):
22
if
_python3:
23
r =
""
.join(
"{0:02x}"
.
format
(c)
for
c
in
s)
# <-- Python 3 is OK
24
else
:
25
r =
""
.join(
"{0:02x}"
.
format
(
ord
(c))
for
c
in
s)
26
while
r[0] ==
'0'
: r = r[1:]
27
return
r
28
29
def
to_x
(s):
30
from
struct
import
pack
31
if
not
s:
return
'0'
32
x = pack(
">q"
, s)
33
while
x[0]
in
(
'\0'
, 0): x = x[1:]
34
return
to_hex2
(x)
35
36
def
to_x_32
(s):
37
from
struct
import
pack
38
if
not
s:
return
'0'
39
x = pack(
">i"
, s)
40
while
x[0]
in
(
'\0'
, 0): x = x[1:]
41
return
to_hex2
(x)
http2_test_server.format
format
Definition:
http2_test_server.py:118
absl::compare_internal::ord
ord
Definition:
abseil-cpp/absl/types/compare.h:79
xprint.to_x
def to_x(s)
Definition:
xprint.py:29
xprint.to_hex
def to_hex(s, prefix_0x=True)
Definition:
xprint.py:9
xprint.to_hex2
def to_hex2(s)
Definition:
xprint.py:21
xprint.to_x_32
def to_x_32(s)
Definition:
xprint.py:36
grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:00