godot/core
Hein-Pieter van Braam 8ff6e53833 Correct Variant::hash_compare()
There was a logic error in #7815 which made
Variant.hash_compare() == Variant.hash_compare() always true.
In an attempt to short-circuit the NaN check I made an (in hindsight) obvious
error: 10 == 12 || is_nan(10) == is_nan(12)

This will be true for all inputs, except for the NaN, not-NaN case. The macro
has been updated to now generate:

(10 == 12) || (is_nan(10) && is_nan(10))

so:

(10 == 12)   || (is_nan(10)  && is_nan(12))  = false
   False  or (False and False) is False
(10 == 10)   || (is_nan(10)  && is_nan(10))  = true
   True or (False and False) is True
(Nan == 10)  || (is_nan(NaN) && is_nan(10))  = false
   False or (True and False) is False
(Nan == Nan) || (is_nan(NaN) && is_nan(NaN)) = true
   False or (True and True) is True

Which is correct for all cases.

This bug was triggered because the hash function for floating point numbers
can very easily generate collisions for the tested Vector3(). I've also added
an extra hashing step to the float hash function to make this less likely to
occur.

This fixes #8081 and probably many more random weirdness.
2017-04-14 11:31:18 +02:00
..
bind Rename [gs]et_pos to [gs]et_position for Controls 2017-04-10 08:27:34 +02:00
helper Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
io Fix a pesky bug in marshalls.cpp/encode_variant 2017-04-11 20:17:56 +03:00
math Particle system is complete. Rejoice! 2017-04-08 22:40:06 -03:00
os Rename [gs]et_pos to [gs]et_position for Controls 2017-04-10 08:27:34 +02:00
SCsub Implement single-field property change for multinode edit 2017-03-02 10:42:05 +01:00
allocators.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
array.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
array.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
class_db.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
class_db.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
color.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
color.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
color_names.inc Add missing map.h include in color defs 2017-01-15 12:51:47 +01:00
command_queue_mt.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
command_queue_mt.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
compressed_translation.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
compressed_translation.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
core_string_names.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
core_string_names.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
dictionary.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
dictionary.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
dvector.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
dvector.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
engine.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
engine.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
error_list.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
error_macros.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
error_macros.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
event_queue.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
event_queue.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
func_ref.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
func_ref.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
global_config.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
global_config.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
global_constants.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
global_constants.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
hash_map.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
hashfuncs.h Correct Variant::hash_compare() 2017-04-14 11:31:18 +02:00
hq2x.cpp Fixed HQ2x compiler warnings 2016-07-05 16:52:31 +02:00
hq2x.h Finalized DynamicFont implementation 2016-05-29 11:37:52 -03:00
image.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
image.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
input_map.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
input_map.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
int_types.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
list.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
make_binders.py ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to Variant. 2017-01-02 23:03:46 -03:00
map.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
message_queue.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
message_queue.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
method_bind.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
method_bind.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
method_ptrcall.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
object.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
object.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
packed_data_container.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
packed_data_container.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
pair.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
path_db.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
path_db.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
path_remap.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
path_remap.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
pool_allocator.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
pool_allocator.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
print_string.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
print_string.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ref_ptr.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ref_ptr.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
reference.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
reference.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
register_core_types.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
register_core_types.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
resource.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
resource.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
rid.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
rid.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ring_buffer.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
safe_refcount.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
safe_refcount.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_debugger_local.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_debugger_local.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_debugger_remote.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_debugger_remote.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_language.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
script_language.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
self_list.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
set.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
simple_type.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
sort.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
string_db.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
string_db.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
translation.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
translation.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
typedefs.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ucaps.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
undo_redo.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
undo_redo.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ustring.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
ustring.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant.cpp Correct Variant::hash_compare() 2017-04-14 11:31:18 +02:00
variant.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant_call.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant_construct_string.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant_op.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant_parser.cpp Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
variant_parser.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
vector.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
vmap.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
vset.h Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00