Mercurial Hosting > luan
comparison src/luan/modules/BasicLuan.java @ 1214:bae51e2d34c9
fix binary hash_code
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 19 Mar 2018 16:55:05 -0600 |
parents | 73d754b1889f |
children | e38f5869e9df |
comparison
equal
deleted
inserted
replaced
1213:d5d5d29d7592 | 1214:bae51e2d34c9 |
---|---|
5 import java.lang.reflect.Method; | 5 import java.lang.reflect.Method; |
6 import java.util.Iterator; | 6 import java.util.Iterator; |
7 import java.util.Map; | 7 import java.util.Map; |
8 import java.util.List; | 8 import java.util.List; |
9 import java.util.ArrayList; | 9 import java.util.ArrayList; |
10 import java.util.Arrays; | |
10 import luan.Luan; | 11 import luan.Luan; |
11 import luan.LuanState; | 12 import luan.LuanState; |
12 import luan.LuanTable; | 13 import luan.LuanTable; |
13 import luan.LuanFunction; | 14 import luan.LuanFunction; |
14 import luan.LuanException; | 15 import luan.LuanException; |
217 } | 218 } |
218 | 219 |
219 public static int hash_code(Object obj) throws LuanException { | 220 public static int hash_code(Object obj) throws LuanException { |
220 if( obj == null ) { | 221 if( obj == null ) { |
221 return 0; | 222 return 0; |
223 } else if( obj instanceof byte[] ) { | |
224 return Arrays.hashCode((byte[])obj); | |
222 } else { | 225 } else { |
223 return obj.hashCode(); | 226 return obj.hashCode(); |
224 } | 227 } |
225 } | 228 } |
226 | 229 |