-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
188 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "AlignedBinaryFormat" | ||
uuid = "94fc9360-1a5e-4d84-93be-ddbadb32b3a7" | ||
authors = ["m-wells <[email protected]>"] | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
|
||
[deps] | ||
Mmap = "a63ad114-7e13-5084-954f-fe012c677804" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const LIT_ENDIAN = 0x04030201 | ||
const BIG_ENDIAN = 0x01020304 | ||
|
||
const LIT_ENDFLAG = UInt8(0) | ||
const BIG_ENDFLAG = UInt8(255) | ||
|
||
function write_endian(io::IOStream) | ||
if Base.ENDIAN_BOM == LIT_ENDIAN | ||
write(io, LIT_ENDFLAG) | ||
elseif Base.ENDIAN_BOM == BIG_ENDIAN | ||
write(io, BIG_ENDFLAG) | ||
else | ||
error("ENDIAN_BOM of ", Base.ENDIAN_BOM, " not recognized") | ||
end | ||
end | ||
|
||
function read_endian(io::IOStream) | ||
endflag = read(io, UInt8) | ||
if endflag == LIT_ENDFLAG | ||
endian = LIT_ENDIAN | ||
elseif endflag == BIG_ENDFLAG | ||
endian = BIG_ENDIAN | ||
else | ||
error("ENDIAN FLAG of ", UInt8(endflag), " not recognized") | ||
end | ||
endian == Base.ENDIAN_BOM || error("endian does not match machine endian") | ||
return endian | ||
end |
Oops, something went wrong.