github.com/primecitizens/pcz/std@v0.2.1/runtime/builtin_map.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 //go:build pcz 5 6 package runtime 7 8 import ( 9 "unsafe" 10 11 stdmap "github.com/primecitizens/pcz/std/builtin/map" 12 "github.com/primecitizens/pcz/std/core/abi" 13 ) 14 15 // 16 // map 17 // 18 19 func makemap64(t *abi.MapType, hint int64, mapbuf *stdmap.HashMap) *stdmap.HashMap { 20 if int64(int(hint)) != hint { 21 hint = 0 22 } 23 24 return stdmap.Make(t, int(hint), mapbuf) 25 } 26 27 func makemap(t *abi.MapType, hint int, mapbuf *stdmap.HashMap) *stdmap.HashMap { 28 return stdmap.Make(t, hint, mapbuf) 29 } 30 31 func makemap_small() *stdmap.HashMap { return stdmap.MakeSmall() } 32 33 func mapaccess1(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) unsafe.Pointer { 34 return stdmap.MapAccess1(t, h, key) 35 } 36 37 func mapaccess1_fast32(t *abi.MapType, h *stdmap.HashMap, key uint32) unsafe.Pointer { 38 return stdmap.MapAccess1Fast32(t, h, key) 39 } 40 41 func mapaccess1_fast64(t *abi.MapType, h *stdmap.HashMap, key uint64) unsafe.Pointer { 42 return stdmap.MapAccess1Fast64(t, h, key) 43 } 44 45 func mapaccess1_faststr(t *abi.MapType, h *stdmap.HashMap, key string) unsafe.Pointer { 46 return stdmap.MapAccess1FastString(t, h, key) 47 } 48 49 func mapaccess1_fat(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer, zero *abi.Type) unsafe.Pointer { 50 return stdmap.MapAccess1Fat(t, h, key, zero) 51 } 52 53 func mapaccess2(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) (unsafe.Pointer, bool) { 54 return stdmap.MapAccess2(t, h, key) 55 } 56 57 func mapaccess2_fast32(t *abi.MapType, h *stdmap.HashMap, key uint32) (unsafe.Pointer, bool) { 58 return stdmap.MapAccess2Fast32(t, h, key) 59 } 60 61 func mapaccess2_fast64(t *abi.MapType, h *stdmap.HashMap, key uint64) (unsafe.Pointer, bool) { 62 return stdmap.MapAccess2Fast64(t, h, key) 63 } 64 65 func mapaccess2_faststr(t *abi.MapType, h *stdmap.HashMap, key string) (unsafe.Pointer, bool) { 66 return stdmap.MapAccess2FastString(t, h, key) 67 } 68 69 func mapaccess2_fat(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer, zero *abi.Type) (unsafe.Pointer, bool) { 70 return stdmap.MapAccess2Fat(t, h, key, zero) 71 } 72 73 func mapassign(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) unsafe.Pointer { 74 return stdmap.MapAssign(t, h, key) 75 } 76 77 func mapassign_fast32(t *abi.MapType, h *stdmap.HashMap, key uint32) unsafe.Pointer { 78 return stdmap.MapAssignFast32(t, h, key) 79 } 80 81 func mapassign_fast32ptr(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) unsafe.Pointer { 82 return stdmap.MapAssignFast32Ptr(t, h, key) 83 } 84 85 func mapassign_fast64(t *abi.MapType, h *stdmap.HashMap, key uint64) unsafe.Pointer { 86 return stdmap.MapAssignFast64(t, h, key) 87 } 88 89 func mapassign_fast64ptr(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) unsafe.Pointer { 90 return stdmap.MapAssignFast64Ptr(t, h, key) 91 } 92 93 func mapassign_faststr(t *abi.MapType, h *stdmap.HashMap, key string) unsafe.Pointer { 94 return stdmap.MapAssignFastString(t, h, key) 95 } 96 97 func mapdelete(t *abi.MapType, h *stdmap.HashMap, key unsafe.Pointer) { 98 stdmap.MapDelete(t, h, key) 99 } 100 101 func mapdelete_fast32(t *abi.MapType, h *stdmap.HashMap, key uint32) { 102 stdmap.MapDeleteFast32(t, h, key) 103 } 104 105 func mapdelete_fast64(t *abi.MapType, h *stdmap.HashMap, key uint64) { 106 stdmap.MapDeleteFast64(t, h, key) 107 } 108 109 func mapdelete_faststr(t *abi.MapType, h *stdmap.HashMap, key string) { 110 stdmap.MapDeleteFastString(t, h, key) 111 } 112 113 func mapiterinit(t *abi.MapType, h *stdmap.HashMap, it *hiter) { 114 stdmap.MapIterInit(t, h, it) 115 } 116 117 func mapiternext(it *hiter) { 118 stdmap.MapIterNext(it) 119 } 120 121 func mapclear(t *abi.MapType, h *stdmap.HashMap) { 122 stdmap.MapClear(t, h) 123 }