Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2bd0f96

Browse files
committed
Store bools as objects in Hashes, since the Dynamic-Bool conversion is optimized, and so the type information is kept. Closes HaxeFoundation#162.
1 parent a9362b9 commit 2bd0f96

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/hx/Hash.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ void __int_hash_set(Dynamic &ioHash,int inKey,const Dynamic &value)
3333
else
3434
{
3535
ObjectType type = (ObjectType)value->__GetType();
36-
if (type==vtBool || type==vtInt)
36+
if (type==vtInt)
3737
hash = new IntHashInt();
3838
else if (type==vtFloat)
3939
hash = new IntHashFloat();
4040
else if (type==vtString)
4141
hash = new IntHashString();
42-
else
42+
else // Object or bool
4343
hash = new IntHashObject();
4444
}
4545
#endif
@@ -51,7 +51,7 @@ void __int_hash_set(Dynamic &ioHash,int inKey,const Dynamic &value)
5151
if (value!=null())
5252
{
5353
ObjectType type = (ObjectType)value->__GetType();
54-
if (type==vtBool || type==vtInt)
54+
if ( type==vtInt)
5555
{
5656
if (hash->store==hashFloat)
5757
want = hashFloat;
@@ -222,7 +222,7 @@ void __string_hash_set(Dynamic &ioHash,String inKey,const Dynamic &value, bool i
222222
else
223223
{
224224
ObjectType type = (ObjectType)value->__GetType();
225-
if (type==vtBool || type==vtInt)
225+
if (type==vtInt)
226226
{
227227
hash = new StringHashInt();
228228
}
@@ -242,7 +242,7 @@ void __string_hash_set(Dynamic &ioHash,String inKey,const Dynamic &value, bool i
242242
if (value!=null())
243243
{
244244
ObjectType type = (ObjectType)value->__GetType();
245-
if (type==vtBool || type==vtInt)
245+
if (type==vtInt)
246246
{
247247
if (hash->store==hashFloat)
248248
want = hashFloat;
@@ -422,7 +422,7 @@ void __object_hash_set(Dynamic &ioHash,Dynamic inKey,const Dynamic &value,bool i
422422
else
423423
{
424424
ObjectType type = (ObjectType)value->__GetType();
425-
if (type==vtBool || type==vtInt)
425+
if (type==vtInt)
426426
{
427427
hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt() :
428428
(DynamicHashBase *)new DynamicHashInt();
@@ -446,7 +446,7 @@ void __object_hash_set(Dynamic &ioHash,Dynamic inKey,const Dynamic &value,bool i
446446
if (value!=null())
447447
{
448448
ObjectType type = (ObjectType)value->__GetType();
449-
if (type==vtBool || type==vtInt)
449+
if (type==vtInt)
450450
{
451451
if (hash->store==hashFloat)
452452
want = hashFloat;

0 commit comments

Comments
 (0)