Skip to content

Instantly share code, notes, and snippets.

@omus
Created September 20, 2017 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omus/21d00be0977d295d6edd94c8c908c308 to your computer and use it in GitHub Desktop.
Save omus/21d00be0977d295d6edd94c8c908c308 to your computer and use it in GitHub Desktop.
Ts = sort!(Base.uniontypes(Base.BitInteger), by=T->(!(T<:Signed),sizeof(T)));
for (i, T) in enumerate(Ts), (j, S) in enumerate(Ts)
i < j || continue
(T <: Signed) ⊻ (S <: Signed) || continue
P = promote_type(T, S)
@printf "%-7s + %-7s => %-7s\n" T S P
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment