(ctx *WriteContext, value reflect.Value)
| 510 | } |
| 511 | |
| 512 | func (s uint8ArraySerializer) WriteData(ctx *WriteContext, value reflect.Value) { |
| 513 | buf := ctx.Buffer() |
| 514 | length := value.Len() |
| 515 | buf.WriteLength(length) |
| 516 | if length > 0 { |
| 517 | if value.CanAddr() { |
| 518 | // Fast path: direct memory copy - uint8 is 1 byte |
| 519 | ptr := value.Addr().UnsafePointer() |
| 520 | buf.WriteBinary(unsafe.Slice((*byte)(ptr), length)) |
| 521 | } else { |
| 522 | // Slow path for non-addressable arrays |
| 523 | for i := 0; i < length; i++ { |
| 524 | buf.WriteByte(byte(value.Index(i).Uint())) |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | func (s uint8ArraySerializer) Write(ctx *WriteContext, refMode RefMode, writeType bool, hasGenerics bool, value reflect.Value) { |
| 531 | writeArrayRefAndType(ctx, refMode, writeType, value, BINARY) |
no test coverage detected