@@ -10,12 +10,8 @@ var Pervasives = require("./pervasives.js");
10
10
var Caml_primitive = require ( "./caml_primitive.js" ) ;
11
11
var Caml_builtin_exceptions = require ( "./caml_builtin_exceptions.js" ) ;
12
12
13
- function length ( x ) {
14
- return x . length - 1 | 0 ;
15
- }
16
-
17
13
function fill ( ar , ofs , len , x ) {
18
- if ( ofs < 0 || len < 0 || ( ofs + len | 0 ) > ( ar . length - 1 | 0 ) ) {
14
+ if ( ofs < 0 || len < 0 || ( ofs + len | 0 ) > ar . length ) {
19
15
throw [
20
16
Caml_builtin_exceptions . invalid_argument ,
21
17
"Weak.fill"
@@ -61,7 +57,7 @@ function Make(H) {
61
57
while ( true ) {
62
58
var accu = _accu ;
63
59
var i = _i ;
64
- if ( i >= ( b . length - 1 | 0 ) ) {
60
+ if ( i >= b . length ) {
65
61
return accu ;
66
62
} else {
67
63
var match = Caml_weak . caml_weak_get ( b , i ) ;
@@ -83,7 +79,7 @@ function Make(H) {
83
79
var b = param ;
84
80
while ( true ) {
85
81
var i = _i ;
86
- if ( i >= ( b . length - 1 | 0 ) ) {
82
+ if ( i >= b . length ) {
87
83
return /* () */ 0 ;
88
84
} else {
89
85
var match = Caml_weak . caml_weak_get ( b , i ) ;
@@ -106,7 +102,7 @@ function Make(H) {
106
102
var b = param$1 ;
107
103
while ( true ) {
108
104
var i = _i ;
109
- if ( i >= ( b . length - 1 | 0 ) ) {
105
+ if ( i >= b . length ) {
110
106
return /* () */ 0 ;
111
107
} else {
112
108
var match = Caml_weak . caml_weak_check ( b , i ) ;
@@ -126,7 +122,7 @@ function Make(H) {
126
122
while ( true ) {
127
123
var accu = _accu ;
128
124
var i = _i ;
129
- if ( i >= ( b . length - 1 | 0 ) ) {
125
+ if ( i >= b . length ) {
130
126
return accu ;
131
127
} else {
132
128
_accu = accu + (
@@ -151,7 +147,7 @@ function Make(H) {
151
147
var test_shrink_bucket = function ( t ) {
152
148
var bucket = Caml_array . caml_array_get ( t [ /* table */ 0 ] , t [ /* rover */ 4 ] ) ;
153
149
var hbucket = Caml_array . caml_array_get ( t [ /* hashes */ 1 ] , t [ /* rover */ 4 ] ) ;
154
- var len = bucket . length - 1 | 0 ;
150
+ var len = bucket . length ;
155
151
var prev_len = prev_sz ( len ) ;
156
152
var live = count_bucket ( 0 , bucket , 0 ) ;
157
153
if ( live <= prev_len ) {
@@ -178,7 +174,7 @@ function Make(H) {
178
174
}
179
175
} ;
180
176
} ;
181
- loop ( 0 , ( bucket . length - 1 | 0 ) - 1 | 0 ) ;
177
+ loop ( 0 , bucket . length - 1 | 0 ) ;
182
178
if ( prev_len === 0 ) {
183
179
Caml_array . caml_array_set ( t [ /* table */ 0 ] , t [ /* rover */ 4 ] , emptybucket ) ;
184
180
Caml_array . caml_array_set ( t [ /* hashes */ 1 ] , t [ /* rover */ 4 ] , /* array */ [ ] ) ;
@@ -197,7 +193,7 @@ function Make(H) {
197
193
var add_aux = function ( t , setter , d , h , index ) {
198
194
var bucket = Caml_array . caml_array_get ( t [ /* table */ 0 ] , index ) ;
199
195
var hashes = Caml_array . caml_array_get ( t [ /* hashes */ 1 ] , index ) ;
200
- var sz = bucket . length - 1 | 0 ;
196
+ var sz = bucket . length ;
201
197
var _i = 0 ;
202
198
while ( true ) {
203
199
var i = _i ;
@@ -271,7 +267,7 @@ function Make(H) {
271
267
var index = get_index ( t , h ) ;
272
268
var bucket = Caml_array . caml_array_get ( t [ /* table */ 0 ] , index ) ;
273
269
var hashes = Caml_array . caml_array_get ( t [ /* hashes */ 1 ] , index ) ;
274
- var sz = bucket . length - 1 | 0 ;
270
+ var sz = bucket . length ;
275
271
var _i = 0 ;
276
272
while ( true ) {
277
273
var i = _i ;
@@ -318,7 +314,7 @@ function Make(H) {
318
314
var index = get_index ( t , h ) ;
319
315
var bucket = Caml_array . caml_array_get ( t [ /* table */ 0 ] , index ) ;
320
316
var hashes = Caml_array . caml_array_get ( t [ /* hashes */ 1 ] , index ) ;
321
- var sz = bucket . length - 1 | 0 ;
317
+ var sz = bucket . length ;
322
318
var _i = 0 ;
323
319
while ( true ) {
324
320
var i = _i ;
@@ -358,7 +354,7 @@ function Make(H) {
358
354
var index = get_index ( t , h ) ;
359
355
var bucket = Caml_array . caml_array_get ( t [ /* table */ 0 ] , index ) ;
360
356
var hashes = Caml_array . caml_array_get ( t [ /* hashes */ 1 ] , index ) ;
361
- var sz = bucket . length - 1 | 0 ;
357
+ var sz = bucket . length ;
362
358
var _i = 0 ;
363
359
var _accu = /* [] */ 0 ;
364
360
while ( true ) {
@@ -398,7 +394,9 @@ function Make(H) {
398
394
} ;
399
395
var stats = function ( t ) {
400
396
var len = t [ /* table */ 0 ] . length ;
401
- var lens = $$Array . map ( length , t [ /* table */ 0 ] ) ;
397
+ var lens = $$Array . map ( ( function ( prim ) {
398
+ return prim . length ;
399
+ } ) , t [ /* table */ 0 ] ) ;
402
400
$$Array . sort ( Caml_obj . caml_compare , lens ) ;
403
401
var totlen = $$Array . fold_left ( ( function ( prim , prim$1 ) {
404
402
return prim + prim$1 | 0 ;
@@ -430,6 +428,10 @@ function Make(H) {
430
428
431
429
var create = Caml_weak . caml_weak_create ;
432
430
431
+ function length ( prim ) {
432
+ return prim . length ;
433
+ }
434
+
433
435
var set = Caml_weak . caml_weak_set ;
434
436
435
437
var get = Caml_weak . caml_weak_get ;
0 commit comments