Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### V0.7.0

- Support reflecting 128-bit integer types.

#### v0.6.1

- Add STACKS container to avoid creating new types in this module from jlrs.
Expand Down
2 changes: 2 additions & 0 deletions src/Reflect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,12 @@ function insertbuiltins!(layouts::IdDict{DataType,Layout})::Nothing
layouts[UInt16] = BuiltinLayout("u16", [], false, false, false)
layouts[UInt32] = BuiltinLayout("u32", [], false, false, false)
layouts[UInt64] = BuiltinLayout("u64", [], false, false, false)
layouts[UInt128] = BuiltinLayout("u128", [], false, false, false)
layouts[Int8] = BuiltinLayout("i8", [], false, false, false)
layouts[Int16] = BuiltinLayout("i16", [], false, false, false)
layouts[Int32] = BuiltinLayout("i32", [], false, false, false)
layouts[Int64] = BuiltinLayout("i64", [], false, false, false)
layouts[Int128] = BuiltinLayout("i128", [], false, false, false)

layouts[Float32] = BuiltinLayout("f32", [], false, false, false)
layouts[Float64] = BuiltinLayout("f64", [], false, false, false)
Expand Down
32 changes: 32 additions & 0 deletions test/SingleFieldBits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ struct BitsTypeFloat64
a::Float64
end

struct BitsTypeU128
a::UInt128
end

struct BitsTypeI128
a::Int128
end

@testset "Single-field bits types" begin
@test begin
b = Reflect.reflect([BitsTypeBool])
Expand Down Expand Up @@ -222,4 +230,28 @@ end
pub a: f64,
}"""
end

@test begin
b = Reflect.reflect([BitsTypeU128])
sb = Reflect.StringLayouts(b)

sb[BitsTypeU128] === """#[repr(C)]
#[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, IntoJulia, ValidField, IsBits, ConstructType, CCallArg, CCallReturn)]
#[jlrs(julia_type = "Main.BitsTypeU128")]
pub struct BitsTypeU128 {
pub a: u128,
}"""
end

@test begin
b = Reflect.reflect([BitsTypeI128])
sb = Reflect.StringLayouts(b)

sb[BitsTypeI128] === """#[repr(C)]
#[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, IntoJulia, ValidField, IsBits, ConstructType, CCallArg, CCallReturn)]
#[jlrs(julia_type = "Main.BitsTypeI128")]
pub struct BitsTypeI128 {
pub a: i128,
}"""
end
end
Loading