new
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
|
||||
- [x] Stack
|
||||
- [x] Queue
|
||||
- [x] Linked List
|
||||
- [x] Double Linked List
|
||||
- [x] Circular Buffer
|
||||
- [ ] Deque
|
||||
- [ ] Deque (segmented array), ⛔ Not possible in Go
|
||||
|
||||
## Tree — hierarchical, parent/child relationships
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// GetChunkSize() -> returns the amount of elements for chunk or 1
|
||||
// if size of T > 521, (unused)
|
||||
// c++ 512 bytes implementation
|
||||
func GetChunkSize[T any](val T) uintptr {
|
||||
return max(512/unsafe.Sizeof(*new(T)), 1)
|
||||
}
|
||||
Reference in New Issue
Block a user