Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
stdpp
Commits
cf70f15e
Commit
cf70f15e
authored
3 years ago
by
Michael Sammler
Browse files
Options
Downloads
Patches
Plain Diff
tweak comment
parent
9016a9b5
No related branches found
No related tags found
1 merge request
!254
Add little endian encoding of Z
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/list_numbers.v
+5
-3
5 additions, 3 deletions
theories/list_numbers.v
with
5 additions
and
3 deletions
theories/list_numbers.v
+
5
−
3
View file @
cf70f15e
...
...
@@ -30,15 +30,17 @@ Notation max_list := (max_list_with id).
(** [Z_to_little_endian m n z] converts [z] into a list of [m] [n]-bit
integers in the little endian format. A negative [z] is encoded using
two's-complement. If [z] uses more than [m * n] bits, these additional
bits are discarded (see [Z_of_to_little_endian]). [n] should be non-negative. *)
bits are discarded (see [Z_of_to_little_endian]). [n] should be non-negative.
*)
Fixpoint
Z_to_little_endian
(
m
:
nat
)
(
n
:
Z
)
(
z
:
Z
)
:
list
Z
:=
match
m
with
|
O
=>
[]
|
S
m'
=>
Z
.
land
z
(
Z
.
ones
n
)
::
Z_to_little_endian
m'
n
(
z
≫
n
)
end
.
(** [Z_of_little_endian n bs] converts the list [bs] of [n]-bit integers into
a number by interpreting [bs] as the little endian encoding. *)
(** [Z_of_little_endian n bs] converts the list [bs] of [n]-bit integers
into a number by interpreting [bs] as the little endian encoding.
The integers [b] in [bs] should be in the range [0 ≤ b < 2 ^ n]. *)
Fixpoint
Z_of_little_endian
(
n
:
Z
)
(
bs
:
list
Z
)
:
Z
:=
match
bs
with
|
[]
=>
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment