aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/atom.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-02-20 16:33:30 +0100
committerBjörn-Egil Dahlberg <[email protected]>2013-02-20 16:33:30 +0100
commitec25c466c944538af915f44dc5e7d6e84f943617 (patch)
treebfd38ecd76d92087a20bd0a4fbacdb67a3d00dd6 /erts/emulator/beam/atom.c
parent47f3fc9c5d19b9606a5b4918624bfb6e94df6c85 (diff)
parent804bf6eca9a1d20b36bbafddcb7caa1339551f5e (diff)
downloadotp-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.c10
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;