MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / __int_hash_set

Function __int_hash_set

src/hx/Hash.cpp:31–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void __int_hash_set(HX_MAP_THIS_ARG,int inKey,const Dynamic &value)
32{
33 IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
34 if (!hash)
35 {
36 if (value==null())
37 {
38 hash = new IntHashObject();
39 }
40 else
41 {
42 hxObjectType type = (hxObjectType)value->__GetType();
43 switch (type)
44 {
45 case vtInt : hash = new IntHashInt(); break;
46 case vtFloat : hash = new IntHashFloat(); break;
47 case vtString: hash = new IntHashString(); break;
48 case vtInt64 : hash = new IntHashInt64(); break;
49 default : hash = new IntHashObject(); break;
50 }
51 }
52 ioHash = hash;
53 HX_OBJ_WB_GET(owner,hash);
54 }
55 else if (hash->store!=hashObject)
56 {
57 HashStore want = hashObject;
58 if (value!=null())
59 {
60 hxObjectType type = (hxObjectType)value->__GetType();
61 if (type==vtInt)
62 {
63 if (hash->store==hashFloat)
64 want = hashFloat;
65 else if (hash->store==hashInt)
66 want = hashInt;
67 else if (hash->store==hashInt64)
68 want = hashInt64;
69 }
70 else if (type==vtFloat)
71 {
72 if (hash->store==hashInt || hash->store==hashFloat)
73 want = hashFloat;
74 }
75 else if (type==vtString)
76 {
77 if (hash->store==hashString)
78 want = hashString;
79 }
80 else if (type==vtInt64)
81 {
82 if (hash->store==hashInt || hash->store==hashInt64)
83 want = hashInt64;
84 }
85 }
86 if (hash->store!=want)
87 {
88 hash = hash->convertStore(want);

Callers

nothing calls this directly

Calls 5

GetPtrMethod · 0.80
convertStoreMethod · 0.80
nullClass · 0.50
__GetTypeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected