diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b33b8..2941631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/Reflect.jl b/src/Reflect.jl index 5ecb2ee..2181d4b 100644 --- a/src/Reflect.jl +++ b/src/Reflect.jl @@ -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) diff --git a/test/SingleFieldBits.jl b/test/SingleFieldBits.jl index d80f7b1..ee269fd 100644 --- a/test/SingleFieldBits.jl +++ b/test/SingleFieldBits.jl @@ -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]) @@ -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