diff options
| author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-09-03 14:22:16 +0300 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-11-26 14:25:48 +0200 |
| commit | 99666de00fb30cb86473257776504ca70b4469c3 (patch) | |
| tree | 6ad5723c1a429e82b8b4b12cc10f2bec3102cac3 /core/templates | |
| parent | 07d14f5bb8e8a2cb3b2137d1ef4fb6c3b46c0873 (diff) | |
| download | redot-engine-99666de00fb30cb86473257776504ca70b4469c3.tar.gz | |
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
Diffstat (limited to 'core/templates')
| -rw-r--r-- | core/templates/hashfuncs.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/templates/hashfuncs.h b/core/templates/hashfuncs.h index 86bb1b5228..1ed9ab1987 100644 --- a/core/templates/hashfuncs.h +++ b/core/templates/hashfuncs.h @@ -114,6 +114,24 @@ static inline uint32_t make_uint32_t(T p_in) { return _u._u32; } +static inline uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_prev = 5381) { + union { + double d; + uint64_t i; + } u; + + // Normalize +/- 0.0 and NaN values so they hash the same. + if (p_in == 0.0f) { + u.d = 0.0; + } else if (Math::is_nan(p_in)) { + u.d = Math_NAN; + } else { + u.d = p_in; + } + + return ((p_prev << 5) + p_prev) + u.i; +} + static inline uint64_t hash_djb2_one_64(uint64_t p_in, uint64_t p_prev = 5381) { return ((p_prev << 5) + p_prev) + p_in; } |
