had to fix the string hash for opal

This commit is contained in:
Torsten Ruger 2016-12-28 13:53:57 +02:00
parent 4940bc41a3
commit a8f3d5a634

View File

@ -61,7 +61,15 @@ module Parfait
end end
def self.str_hash(str) def self.str_hash(str)
str = str.hash if RUBY_ENGINE == "OPAL"
hash = 5381
str.to_s.each_char do |c|
hash = ((hash << 5) + hash) + c.to_i; # hash * 33 + c without getting bignums
end
hash % (2 ** 51)
else
str.hash
end
end end
def initialize( object_class , hash = {}) def initialize( object_class , hash = {})