diff options
author | Björn-Egil Dahlberg <[email protected]> | 2013-02-20 16:33:30 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2013-02-20 16:33:30 +0100 |
commit | ec25c466c944538af915f44dc5e7d6e84f943617 (patch) | |
tree | bfd38ecd76d92087a20bd0a4fbacdb67a3d00dd6 /erts/emulator/beam/atom.c | |
parent | 47f3fc9c5d19b9606a5b4918624bfb6e94df6c85 (diff) | |
parent | 804bf6eca9a1d20b36bbafddcb7caa1339551f5e (diff) | |
download | otp-ec25c466c944538af915f44dc5e7d6e84f943617.tar.gz otp-ec25c466c944538af915f44dc5e7d6e84f943617.tar.bz2 otp-ec25c466c944538af915f44dc5e7d6e84f943617.zip |
Merge branch 'egil/fix-atom-hash/OTP-10860'
* egil/fix-atom-hash/OTP-10860:
tests: Testing hash values of unicode atoms
erts: Fix atom hash for latin1 characters
tests: Add latin1 chars atom test
Diffstat (limited to 'erts/emulator/beam/atom.c')
-rw-r--r-- | erts/emulator/beam/atom.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/beam/atom.c b/erts/emulator/beam/atom.c index b69f979397..84d2d5e3ed 100644 --- a/erts/emulator/beam/atom.c +++ b/erts/emulator/beam/atom.c @@ -132,9 +132,17 @@ atom_hash(Atom* obj) byte* p = obj->name; int len = obj->len; HashValue h = 0, g; + byte v; while(len--) { - h = (h << 4) + *p++; + v = *p++; + /* latin1 clutch for r16 */ + if ((v & 0xFE) == 0xC2 && (*p & 0xC0) == 0x80) { + v = (v << 6) | (*p & 0x3F); + p++; len--; + } + /* normal hashpjw follows for v */ + h = (h << 4) + v; if ((g = h & 0xf0000000)) { h ^= (g >> 24); h ^= g; |