Skip to content

Conversation

@KristofferC
Copy link
Member

creating a new Julia array that gets reinterpreted etc can be avoided by just picking out the bytes we want

@tecosaur
Copy link
Member

tecosaur commented Aug 4, 2024

Ah yep, it would be good to get rid of the needless temp arrays, what about doing it like this though?

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

If you're onboard with this, I'll update the PR and merge it.

Instead of creating a temporary array that we reinterpret into another
temporary array, we can just pick out the bytes we want from within the
UInt32.
@KristofferC
Copy link
Member Author

Yep, makes sense as well!

@tecosaur tecosaur merged commit 4d04102 into main Aug 6, 2024
@tecosaur tecosaur deleted the kc/simple_shift branch August 6, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants