Skip to content

Commit

Permalink
Quick fix for 4d04102 (Optimised SimpleColor)
Browse files Browse the repository at this point in the history
Despite it "looking right" and a quick test in the REPL, it turns out I
put the _ in the wrong spot when rewriting the NTuple-based modification
to Kristoffer's commit.

Ooops. Anyway, that's fixed now, and it occurs to me that for
correctness we may as well call "htol" because we assume the byte order
is little-endian when using the results of reinterpret (even though it
will almost always be a no-op).
  • Loading branch information
tecosaur committed Aug 6, 2024
1 parent 4d04102 commit f588218
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/faces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
SimpleColor(r::Integer, g::Integer, b::Integer) = SimpleColor((; r=UInt8(r), g=UInt8(g), b=UInt8(b)))

function SimpleColor(rgb::UInt32)
_, g, b, r = reinterpret(NTuple{4, UInt8}, rgb)
b, g, r, _ = reinterpret(NTuple{4, UInt8}, htol(rgb))
SimpleColor(r, g, b)
end

Expand Down

0 comments on commit f588218

Please sign in to comment.