Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
8f94f962
Commit
8f94f962
authored
Jun 15, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store current_tool in the upper bits of status to save 8 more bytes
parent
9a273b79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
gcoder_line.pyx
printrun/gcoder_line.pyx
+14
-15
No files found.
printrun/gcoder_line.pyx
View file @
8f94f962
...
...
@@ -36,18 +36,18 @@ cdef enum BitPos:
pos_f = 1 << 4
pos_i = 1 << 5
pos_j = 1 << 6
pos_
is_move = 1 << 9
pos_relative
= 1 << 10
pos_
relative_e = 1 << 11
pos_
extruding = 1 << 12
pos_current_
x = 1 << 13
pos_current_
y = 1 << 14
pos_current_
z = 1 << 15
pos_
current_tool = 1 << 16
pos_
raw = 1 << 17
pos_
command = 1 << 18
pos_gcview_end_vertex = 1 << 19
pos_is_move = 1 << 7
pos_
relative = 1 << 8
pos_relative
_e = 1 << 9
pos_
extruding = 1 << 10
pos_
current_x = 1 << 11
pos_current_
y = 1 << 12
pos_current_
z = 1 << 13
pos_current_
tool = 1 << 14
pos_
raw = 1 << 15
pos_
command = 1 << 16
pos_
gcview_end_vertex = 1 << 17
# WARNING: don't use bits 24 to 31 as we store current_tool there
cdef inline uint32_t has_var(uint32_t status, uint32_t pos):
return status & pos
...
...
@@ -66,7 +66,6 @@ cdef class GLine:
cdef float _current_x, _current_y, _current_z
cdef uint32_t _gcview_end_vertex
cdef uint32_t _status
cdef char _current_tool
__slots__ = ()
...
...
@@ -182,10 +181,10 @@ cdef class GLine:
self._status = set_has_var(self._status, pos_current_z)
property current_tool:
def __get__(self):
if has_var(self._status, pos_current_tool): return self._
current_tool
if has_var(self._status, pos_current_tool): return self._
status >> 24
else: return None
def __set__(self, value):
self._
current_tool = value
self._
status = (self._status & ((1 << 24) - 1)) | (value << 24)
self._status = set_has_var(self._status, pos_current_tool)
property gcview_end_vertex:
def __get__(self):
...
...
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