hash_values.dart 3.9 KB

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