github.com/djordje200179/extendedlibrary/datastructures@v1.7.1-0.20240227175559-d09520a92dd4/maps/hashmap/internal.go (about)

     1  package hashmap
     2  
     3  import "unsafe"
     4  
     5  type emptyInterface struct {
     6  	typ unsafe.Pointer
     7  	val unsafe.Pointer
     8  }
     9  
    10  type hmap struct{}
    11  
    12  type maptype struct{}
    13  
    14  func mapTypeAndValue(m interface{}) (*maptype, *hmap) {
    15  	ei := (*emptyInterface)(unsafe.Pointer(&m))
    16  	return (*maptype)(ei.typ), (*hmap)(ei.val)
    17  }
    18  
    19  //go:linkname internalMapGet runtime.mapaccess2
    20  func internalMapGet(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool)