1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 5 package protolazy
6 7 import (
8 "sync/atomic"
9 "unsafe"
10 )
11 12 func atomicLoadIndex(p **[]IndexEntry) *[]IndexEntry {
13 return (*[]IndexEntry)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
14 }
15 func atomicStoreIndex(p **[]IndexEntry, v *[]IndexEntry) {
16 atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
17 }
18