func Uint32Array(name string, values []uint32) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeUint32, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeUint32(v)
		}
	}
}
Uint32Array adds an array of uint32 to the event.
package etw
import (
	"fmt"
	"math"
	"reflect"
	"syscall"
	"time"
	"unsafe"
)
type FieldOpt func(em *eventMetadata, ed *eventData)
func WithFields(opts ...FieldOpt) []FieldOpt {
	return opts
}
func BoolField(name string, value bool) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeUint8, outTypeBoolean, 0)
		bool8 := uint8(0)
		if value {
			bool8 = uint8(1)
		}
		ed.writeUint8(bool8)
	}
}
func BoolArray(name string, values []bool) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeUint8, outTypeBoolean, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			bool8 := uint8(0)
			if v {
				bool8 = uint8(1)
			}
			ed.writeUint8(bool8)
		}
	}
}
func StringField(name string, value string) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeANSIString, outTypeUTF8, 0)
		ed.writeString(value)
	}
}
func StringArray(name string, values []string) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeANSIString, outTypeUTF8, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeString(v)
		}
	}
}
func IntField(name string, value int) FieldOpt {
	switch unsafe.Sizeof(value) {
	case 4:
		return Int32Field(name, int32(value))
	case 8:
		return Int64Field(name, int64(value))
	default:
		panic("Unsupported int size")
	}
}
func IntArray(name string, values []int) FieldOpt {
	inType := inTypeNull
	var writeItem func(*eventData, int)
	switch unsafe.Sizeof(values[0]) {
	case 4:
		inType = inTypeInt32
		writeItem = func(ed *eventData, item int) { ed.writeInt32(int32(item)) }
	case 8:
		inType = inTypeInt64
		writeItem = func(ed *eventData, item int) { ed.writeInt64(int64(item)) }
	default:
		panic("Unsupported int size")
	}
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inType, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			writeItem(ed, v)
		}
	}
}
func Int8Field(name string, value int8) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeInt8, outTypeDefault, 0)
		ed.writeInt8(value)
	}
}
func Int8Array(name string, values []int8) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeInt8, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeInt8(v)
		}
	}
}
func Int16Field(name string, value int16) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeInt16, outTypeDefault, 0)
		ed.writeInt16(value)
	}
}
func Int16Array(name string, values []int16) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeInt16, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeInt16(v)
		}
	}
}
func Int32Field(name string, value int32) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeInt32, outTypeDefault, 0)
		ed.writeInt32(value)
	}
}
func Int32Array(name string, values []int32) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeInt32, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeInt32(v)
		}
	}
}
func Int64Field(name string, value int64) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeInt64, outTypeDefault, 0)
		ed.writeInt64(value)
	}
}
func Int64Array(name string, values []int64) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeInt64, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeInt64(v)
		}
	}
}
func UintField(name string, value uint) FieldOpt {
	switch unsafe.Sizeof(value) {
	case 4:
		return Uint32Field(name, uint32(value))
	case 8:
		return Uint64Field(name, uint64(value))
	default:
		panic("Unsupported uint size")
	}
}
func UintArray(name string, values []uint) FieldOpt {
	inType := inTypeNull
	var writeItem func(*eventData, uint)
	switch unsafe.Sizeof(values[0]) {
	case 4:
		inType = inTypeUint32
		writeItem = func(ed *eventData, item uint) { ed.writeUint32(uint32(item)) }
	case 8:
		inType = inTypeUint64
		writeItem = func(ed *eventData, item uint) { ed.writeUint64(uint64(item)) }
	default:
		panic("Unsupported uint size")
	}
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inType, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			writeItem(ed, v)
		}
	}
}
func Uint8Field(name string, value uint8) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeUint8, outTypeDefault, 0)
		ed.writeUint8(value)
	}
}
func Uint8Array(name string, values []uint8) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeUint8, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeUint8(v)
		}
	}
}
func Uint16Field(name string, value uint16) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeUint16, outTypeDefault, 0)
		ed.writeUint16(value)
	}
}
func Uint16Array(name string, values []uint16) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeArray(name, inTypeUint16, outTypeDefault, 0)
		ed.writeUint16(uint16(len(values)))
		for _, v := range values {
			ed.writeUint16(v)
		}
	}
}
func Uint32Field(name string, value uint32) FieldOpt {
	return func(em *eventMetadata, ed *eventData) {
		em.writeField(name, inTypeUint32, outTypeDefault, 0)
		ed.writeUint32(value)
	}
}