1// compile
2
3// Copyright 2023 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9import (
10	"fmt"
11	"reflect"
12	"unsafe"
13)
14
15var slice = []byte{'H', 'e', 'l', 'l', 'o', ','}
16
17func main() {
18	ptr := uintptr(unsafe.Pointer(&slice)) + 100
19	header := (*reflect.SliceHeader)(unsafe.Pointer(ptr))
20	header.Data += 1
21	fmt.Printf("%d %d\n", cap(slice), header.Cap)
22}
23