-- addDependentFile examples/golden/edge-cases/typedef_bitfield.h
{-| __C declaration:__ @myInt@

    __defined at:__ @edge-cases\/typedef_bitfield.h 2:13@

    __exported by:__ @edge-cases\/typedef_bitfield.h@
-}
newtype MyInt
    = MyInt {unwrapMyInt :: CInt}
      {- ^ __C declaration:__ @myInt@

           __defined at:__ @edge-cases\/typedef_bitfield.h 2:13@

           __exported by:__ @edge-cases\/typedef_bitfield.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType MyInt "unwrapMyInt") =>
         HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapMyInt")
instance HasCField MyInt "unwrapMyInt"
    where type CFieldType MyInt "unwrapMyInt" = CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @myUInt@

    __defined at:__ @edge-cases\/typedef_bitfield.h 3:22@

    __exported by:__ @edge-cases\/typedef_bitfield.h@
-}
newtype MyUInt
    = MyUInt {unwrapMyUInt :: CUInt}
      {- ^ __C declaration:__ @myUInt@

           __defined at:__ @edge-cases\/typedef_bitfield.h 3:22@

           __exported by:__ @edge-cases\/typedef_bitfield.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType MyUInt "unwrapMyUInt") =>
         HasField "unwrapMyUInt" (Ptr MyUInt) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapMyUInt")
instance HasCField MyUInt "unwrapMyUInt"
    where type CFieldType MyUInt "unwrapMyUInt" = CUInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @myLong@

    __defined at:__ @edge-cases\/typedef_bitfield.h 4:14@

    __exported by:__ @edge-cases\/typedef_bitfield.h@
-}
newtype MyLong
    = MyLong {unwrapMyLong :: CLong}
      {- ^ __C declaration:__ @myLong@

           __defined at:__ @edge-cases\/typedef_bitfield.h 4:14@

           __exported by:__ @edge-cases\/typedef_bitfield.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType MyLong "unwrapMyLong") =>
         HasField "unwrapMyLong" (Ptr MyLong) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapMyLong")
instance HasCField MyLong "unwrapMyLong"
    where type CFieldType MyLong "unwrapMyLong" = CLong
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct myStruct@

    __defined at:__ @edge-cases\/typedef_bitfield.h 6:8@

    __exported by:__ @edge-cases\/typedef_bitfield.h@
-}
data MyStruct
    = MyStruct {myStruct_x :: MyInt
                {- ^ __C declaration:__ @x@

                     __defined at:__ @edge-cases\/typedef_bitfield.h 7:9@

                     __exported by:__ @edge-cases\/typedef_bitfield.h@
                -},
                myStruct_y :: MyUInt
                {- ^ __C declaration:__ @y@

                     __defined at:__ @edge-cases\/typedef_bitfield.h 8:10@

                     __exported by:__ @edge-cases\/typedef_bitfield.h@
                -},
                myStruct_z :: MyLong
                {- ^ __C declaration:__ @z@

                     __defined at:__ @edge-cases\/typedef_bitfield.h 9:10@

                     __exported by:__ @edge-cases\/typedef_bitfield.h@
                -}}
      {- ^ __C declaration:__ @struct myStruct@

           __defined at:__ @edge-cases\/typedef_bitfield.h 6:8@

           __exported by:__ @edge-cases\/typedef_bitfield.h@
      -}
    deriving stock (Eq, Show)
instance StaticSize MyStruct
    where staticSizeOf = \_ -> 8 :: Int
          staticAlignment = \_ -> 8 :: Int
instance ReadRaw MyStruct
    where readRaw = \ptr_0 -> ((pure MyStruct <*> peek (Proxy @"myStruct_x") ptr_0) <*> peek (Proxy @"myStruct_y") ptr_0) <*> peek (Proxy @"myStruct_z") ptr_0
instance WriteRaw MyStruct
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       MyStruct myStruct_x_2
                                                myStruct_y_3
                                                myStruct_z_4 -> poke (Proxy @"myStruct_x") ptr_0 myStruct_x_2 >> (poke (Proxy @"myStruct_y") ptr_0 myStruct_y_3 >> poke (Proxy @"myStruct_z") ptr_0 myStruct_z_4)
deriving via (EquivStorable MyStruct) instance Storable MyStruct
instance HasCBitfield MyStruct "myStruct_x"
    where type CBitfieldType MyStruct "myStruct_x" = MyInt
          bitfieldOffset# = \_ -> \_ -> 0
          bitfieldWidth# = \_ -> \_ -> 2
instance TyEq ty (CBitfieldType MyStruct "myStruct_x") =>
         HasField "myStruct_x" (Ptr MyStruct) (BitfieldPtr ty)
    where getField = toPtr (Proxy @"myStruct_x")
instance HasCBitfield MyStruct "myStruct_y"
    where type CBitfieldType MyStruct "myStruct_y" = MyUInt
          bitfieldOffset# = \_ -> \_ -> 2
          bitfieldWidth# = \_ -> \_ -> 4
instance TyEq ty (CBitfieldType MyStruct "myStruct_y") =>
         HasField "myStruct_y" (Ptr MyStruct) (BitfieldPtr ty)
    where getField = toPtr (Proxy @"myStruct_y")
instance HasCBitfield MyStruct "myStruct_z"
    where type CBitfieldType MyStruct "myStruct_z" = MyLong
          bitfieldOffset# = \_ -> \_ -> 6
          bitfieldWidth# = \_ -> \_ -> 3
instance TyEq ty (CBitfieldType MyStruct "myStruct_z") =>
         HasField "myStruct_z" (Ptr MyStruct) (BitfieldPtr ty)
    where getField = toPtr (Proxy @"myStruct_z")
