Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-scripts-888
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-scripts-888
Commits
b58242c5
Commit
b58242c5
authored
Dec 05, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bit.extract, bit.replace
parent
7c918ad9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
utility.lua
utility.lua
+2
-0
No files found.
utility.lua
View file @
b58242c5
...
@@ -37,10 +37,12 @@ local function fieldargs(f,width)
...
@@ -37,10 +37,12 @@ local function fieldargs(f,width)
return
f
,
~
(
-
1
<<
w
)
return
f
,
~
(
-
1
<<
w
)
end
end
function
bit
.
extract
(
r
,
field
,
width
)
function
bit
.
extract
(
r
,
field
,
width
)
width
=
width
or
1
local
f
,
m
=
fieldargs
(
field
,
width
)
local
f
,
m
=
fieldargs
(
field
,
width
)
return
(
r
>>
f
)
&
m
return
(
r
>>
f
)
&
m
end
end
function
bit
.
replace
(
r
,
v
,
field
,
width
)
function
bit
.
replace
(
r
,
v
,
field
,
width
)
width
=
width
or
1
local
f
,
m
=
fieldargs
(
field
,
width
)
local
f
,
m
=
fieldargs
(
field
,
width
)
return
(
r
&~
(
m
<<
f
))
|
((
v
&
m
)
<<
f
)
return
(
r
&~
(
m
<<
f
))
|
((
v
&
m
)
<<
f
)
end
end
...
...
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