hash_values.dart 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. class _HashEnd { const _HashEnd(); }
  2. const _HashEnd _hashEnd = _HashEnd();
  3. class _Jenkins {
  4. static int combine(int hash, Object o) {
  5. assert(o is! Iterable);
  6. hash = 0x1fffffff & (hash + o.hashCode);
  7. hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
  8. return hash ^ (hash >> 6);
  9. }
  10. static int finish(int hash) {
  11. hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
  12. hash = hash ^ (hash >> 11);
  13. return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
  14. }
  15. }
  16. int hashValues(
  17. Object arg01, Object arg02, [ Object arg03 = _hashEnd,
  18. Object arg04 = _hashEnd, Object arg05 = _hashEnd, Object arg06 = _hashEnd,
  19. Object arg07 = _hashEnd, Object arg08 = _hashEnd, Object arg09 = _hashEnd,
  20. Object arg10 = _hashEnd, Object arg11 = _hashEnd, Object arg12 = _hashEnd,
  21. Object arg13 = _hashEnd, Object arg14 = _hashEnd, Object arg15 = _hashEnd,
  22. Object arg16 = _hashEnd, Object arg17 = _hashEnd, Object arg18 = _hashEnd,
  23. Object arg19 = _hashEnd, Object arg20 = _hashEnd ]) {
  24. int result = 0;
  25. result = _Jenkins.combine(result, arg01);
  26. result = _Jenkins.combine(result, arg02);
  27. if (!identical(arg03, _hashEnd)) {
  28. result = _Jenkins.combine(result, arg03);
  29. if (!identical(arg04, _hashEnd)) {
  30. result = _Jenkins.combine(result, arg04);
  31. if (!identical(arg05, _hashEnd)) {
  32. result = _Jenkins.combine(result, arg05);
  33. if (!identical(arg06, _hashEnd)) {
  34. result = _Jenkins.combine(result, arg06);
  35. if (!identical(arg07, _hashEnd)) {
  36. result = _Jenkins.combine(result, arg07);
  37. if (!identical(arg08, _hashEnd)) {
  38. result = _Jenkins.combine(result, arg08);
  39. if (!identical(arg09, _hashEnd)) {
  40. result = _Jenkins.combine(result, arg09);
  41. if (!identical(arg10, _hashEnd)) {
  42. result = _Jenkins.combine(result, arg10);
  43. if (!identical(arg11, _hashEnd)) {
  44. result = _Jenkins.combine(result, arg11);
  45. if (!identical(arg12, _hashEnd)) {
  46. result = _Jenkins.combine(result, arg12);
  47. if (!identical(arg13, _hashEnd)) {
  48. result = _Jenkins.combine(result, arg13);
  49. if (!identical(arg14, _hashEnd)) {
  50. result = _Jenkins.combine(result, arg14);
  51. if (!identical(arg15, _hashEnd)) {
  52. result = _Jenkins.combine(result, arg15);
  53. if (!identical(arg16, _hashEnd)) {
  54. result = _Jenkins.combine(result, arg16);
  55. if (!identical(arg17, _hashEnd)) {
  56. result = _Jenkins.combine(result, arg17);
  57. if (!identical(arg18, _hashEnd)) {
  58. result = _Jenkins.combine(result, arg18);
  59. if (!identical(arg19, _hashEnd)) {
  60. result = _Jenkins.combine(result, arg19);
  61. if (!identical(arg20, _hashEnd)) {
  62. result = _Jenkins.combine(result, arg20);
  63. // I can see my house from here!
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }
  82. return _Jenkins.finish(result);
  83. }
  84. int hashList(Iterable<Object> arguments) {
  85. int result = 0;
  86. if (arguments != null) {
  87. for (Object argument in arguments)
  88. result = _Jenkins.combine(result, argument);
  89. }
  90. return _Jenkins.finish(result);
  91. }