Hex dump: Difference between revisions
Content deleted Content added
m →{{header|Julia}}: adjust display with specified length argument |
|||
Line 490: | Line 490: | ||
<syntaxhighlight lang="julia">function baseddump(io::IO, data::Vector{UInt8}; base = 16, offset = 0, len = -1, displayadjust = 0) |
<syntaxhighlight lang="julia">function baseddump(io::IO, data::Vector{UInt8}; base = 16, offset = 0, len = -1, displayadjust = 0) |
||
@assert 2 <= base <= 16 "display base $base not supported" |
@assert 2 <= base <= 16 "display base $base not supported" |
||
datastop = len < 0 ? length(data) : min(offset + len |
datastop = len < 0 ? length(data) : min(offset + len, length(data)) |
||
bytes = data[begin+offset:datastop] |
bytes = data[begin+offset:datastop] |
||
fullchunksize = base == 16 ? 16 : base > 8 ? 10 : base > 4 ? 8 : 6 |
fullchunksize = base == 16 ? 16 : base > 8 ? 10 : base > 4 ? 8 : 6 |