Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
ef387448
Commit
ef387448
authored
May 25, 2018
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Micro-optimization of p64/u64
parent
365c4398
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
neo/lib/util.py
neo/lib/util.py
+5
-6
No files found.
neo/lib/util.py
View file @
ef387448
...
...
@@ -20,7 +20,7 @@ from binascii import a2b_hex, b2a_hex
from
datetime
import
timedelta
,
datetime
from
hashlib
import
sha1
from
Queue
import
deque
from
struct
import
pack
,
unpack
from
struct
import
pack
,
unpack
,
Struct
from
time
import
gmtime
TID_LOW_OVERFLOW
=
2
**
32
...
...
@@ -102,11 +102,10 @@ def addTID(ptid, offset):
higher
=
(
d
.
year
,
d
.
month
,
d
.
day
,
d
.
hour
,
d
.
minute
)
return
packTID
(
higher
,
lower
)
def
u64
(
s
):
return
unpack
(
'!Q'
,
s
)[
0
]
def
p64
(
n
):
return
pack
(
'!Q'
,
n
)
p64
,
u64
=
(
lambda
unpack
:
(
unpack
.
__self__
.
pack
,
lambda
s
:
unpack
(
s
)[
0
]
))(
Struct
(
'!Q'
).
unpack
)
def
add64
(
packed
,
offset
):
"""Add a python number to a 64-bits packed value"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment