github.com/ii64/gouring@v0.4.1/util_union.go (about)

     1  package gouring
     2  
     3  import "unsafe"
     4  
     5  type union64 [8]byte
     6  
     7  func (u *union64) PutUnsafe(v unsafe.Pointer) { putUnsafe(unsafe.Pointer(u), v) }
     8  func (u *union64) PutUintptr(v uintptr)       { putUintptr(unsafe.Pointer(u), v) }
     9  func (u *union64) PutUint64(v uint64)         { putUint64(unsafe.Pointer(u), v) }
    10  func (u *union64) PutUint32(v uint32)         { putUint32(unsafe.Pointer(u), v) }
    11  func (u *union64) PutUint16(v uint16)         { putUint16(unsafe.Pointer(u), v) }
    12  func (u *union64) PutUint8(v uint8)           { putUint8(unsafe.Pointer(u), v) }
    13  
    14  func (u *union64) PutInt32(v int32) { putInt32(unsafe.Pointer(u), v) }
    15  
    16  func (u *union64) Unsafe() unsafe.Pointer { return unsafe.Pointer(u) }
    17  func (u *union64) Uint64() uint64         { return *(*uint64)(unsafe.Pointer(u)) }
    18  func (u *union64) Uint32() uint32         { return *(*uint32)(unsafe.Pointer(u)) }
    19  func (u *union64) Uint16() uint16         { return *(*uint16)(unsafe.Pointer(u)) }
    20  func (u *union64) Uint8() uint8           { return *(*uint8)(unsafe.Pointer(u)) }
    21  
    22  type union32 [4]byte
    23  
    24  func (u *union32) PutUnsafe(v unsafe.Pointer) { putUnsafe(unsafe.Pointer(u), v) }
    25  func (u *union32) PutUintptr(v uintptr)       { putUintptr(unsafe.Pointer(u), uintptr(uint32(v))) }
    26  func (u *union32) PutUint64(v uint64)         { putUint32(unsafe.Pointer(u), uint32(v)) }
    27  func (u *union32) PutUint32(v uint32)         { putUint32(unsafe.Pointer(u), v) }
    28  func (u *union32) PutUint16(v uint16)         { putUint16(unsafe.Pointer(u), v) }
    29  func (u *union32) PutUint8(v uint8)           { putUint8(unsafe.Pointer(u), v) }
    30  
    31  func (u *union32) PutInt32(v int32) { putInt32(unsafe.Pointer(u), v) }
    32  
    33  func (u *union32) Unsafe() unsafe.Pointer { return unsafe.Pointer(u) }
    34  func (u *union32) Uint64() uint64         { return *(*uint64)(unsafe.Pointer(u)) }
    35  func (u *union32) Uint32() uint32         { return *(*uint32)(unsafe.Pointer(u)) }
    36  func (u *union32) Uint16() uint16         { return *(*uint16)(unsafe.Pointer(u)) }
    37  func (u *union32) Uint8() uint8           { return *(*uint8)(unsafe.Pointer(u)) }
    38  
    39  type union16 [2]byte
    40  
    41  func (u *union16) PutUnsafe(v unsafe.Pointer) { putUnsafe(unsafe.Pointer(u), v) }
    42  func (u *union16) PutUintptr(v uintptr)       { putUintptr(unsafe.Pointer(u), uintptr(uint16(v))) }
    43  func (u *union16) PutUint64(v uint64)         { putUint16(unsafe.Pointer(u), uint16(v)) }
    44  func (u *union16) PutUint32(v uint32)         { putUint16(unsafe.Pointer(u), uint16(v)) }
    45  func (u *union16) PutUint16(v uint16)         { putUint16(unsafe.Pointer(u), v) }
    46  func (u *union16) PutUint8(v uint8)           { putUint8(unsafe.Pointer(u), v) }
    47  
    48  func (u *union16) Unsafe() unsafe.Pointer { return unsafe.Pointer(u) }
    49  func (u *union16) Uint64() uint64         { return *(*uint64)(unsafe.Pointer(u)) }
    50  func (u *union16) Uint32() uint32         { return *(*uint32)(unsafe.Pointer(u)) }
    51  func (u *union16) Uint16() uint16         { return *(*uint16)(unsafe.Pointer(u)) }
    52  func (u *union16) Uint8() uint8           { return *(*uint8)(unsafe.Pointer(u)) }