Skip to content

Commit 0cb9c49

Browse files
committed
fixup! Add support for literals
1 parent ec42896 commit 0cb9c49

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/literals.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export i8, i16, i32, u8, u16, u32
2+
# helper type for writing smaller than Int64 literals
3+
struct Literal{T} end
4+
Base.:(*)(x::Number, ::Type{Literal{T}}) where {T} = T(x)
5+
const i8 = Literal{Int8}
6+
const i16 = Literal{Int16}
7+
const i32 = Literal{Int32}
8+
const u8 = Literal{Int8}
9+
const u16 = Literal{Int16}
10+
const u32 = Literal{Int32}

0 commit comments

Comments
 (0)