MCPcopy Create free account
hub / github.com/apache/fory / storeFieldValue

Function storeFieldValue

go/fory/struct.go:855–870  ·  view source on GitHub ↗
(kind FieldKind, fieldPtr unsafe.Pointer, opt optionalInfo, value T)

Source from the content-addressed store, hash-verified

853}
854
855func storeFieldValue[T any](kind FieldKind, fieldPtr unsafe.Pointer, opt optionalInfo, value T) {
856 switch kind {
857 case FieldKindPointer:
858 ptr := *(**T)(fieldPtr)
859 if ptr == nil {
860 ptr = new(T)
861 *(**T)(fieldPtr) = ptr
862 }
863 *ptr = value
864 case FieldKindOptional:
865 *(*bool)(unsafe.Add(fieldPtr, opt.hasOffset)) = true
866 *(*T)(unsafe.Add(fieldPtr, opt.valueOffset)) = value
867 default:
868 *(*T)(fieldPtr) = value
869 }
870}
871
872func clearFieldValue(kind FieldKind, fieldPtr unsafe.Pointer, opt optionalInfo) {
873 switch kind {

Callers 8

storeCompatibleIntFunction · 0.85
storeCompatibleUintFunction · 0.85
ReadDataMethod · 0.85
readFieldsInOrderMethod · 0.85

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected