github.com/gotranspile/cxgo@v0.3.7/libs/libcc/libcc.go (about) 1 package libcc 2 3 import ( 4 "encoding/binary" 5 6 "github.com/gotranspile/cxgo/types" 7 "modernc.org/cc/v3" 8 ) 9 10 func NewABI(c *types.Env) cc.ABI { 11 intSize := c.IntSize() 12 ptrSize := c.PtrSize() 13 return cc.ABI{ 14 ByteOrder: binary.LittleEndian, 15 Types: map[cc.Kind]cc.ABIType{ 16 cc.Bool: {1, 1, 1}, 17 cc.Char: {1, 1, 1}, 18 cc.Int: {uintptr(intSize), intSize, intSize}, 19 cc.Long: {uintptr(ptrSize), ptrSize, ptrSize}, 20 cc.LongLong: {8, 8, intSize}, 21 cc.SChar: {1, 1, 1}, 22 cc.Short: {2, 2, 2}, 23 cc.UChar: {1, 1, 1}, 24 cc.UInt: {uintptr(intSize), intSize, intSize}, 25 cc.ULong: {uintptr(ptrSize), ptrSize, ptrSize}, 26 cc.ULongLong: {8, 8, intSize}, 27 cc.UShort: {2, 2, 2}, 28 29 cc.Int8: {1, 1, 1}, 30 cc.UInt8: {1, 1, 1}, 31 cc.Int16: {2, 2, 2}, 32 cc.UInt16: {2, 2, 2}, 33 cc.Int32: {4, 4, 4}, 34 cc.UInt32: {4, 4, 4}, 35 cc.Int64: {8, intSize, intSize}, 36 cc.UInt64: {8, intSize, intSize}, 37 38 cc.Float: {4, 4, intSize}, 39 cc.Double: {8, 8, intSize}, 40 cc.LongDouble: {8, 8, intSize}, 41 42 cc.Void: {1, 1, 1}, 43 cc.Ptr: {uintptr(ptrSize), ptrSize, ptrSize}, 44 45 cc.Enum: {uintptr(intSize), intSize, intSize}, 46 }, 47 } 48 }