diff options
Diffstat (limited to 'src/lj_tab.c')
-rw-r--r-- | src/lj_tab.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_tab.c b/src/lj_tab.c index c8e4efe1..830e3023 100644 --- a/src/lj_tab.c +++ b/src/lj_tab.c | |||
@@ -580,20 +580,20 @@ static MSize unbound_search(GCtab *t, MSize j) | |||
580 | MSize i = j; /* i is zero or a present index */ | 580 | MSize i = j; /* i is zero or a present index */ |
581 | j++; | 581 | j++; |
582 | /* find `i' and `j' such that i is present and j is not */ | 582 | /* find `i' and `j' such that i is present and j is not */ |
583 | while ((tv = lj_tab_getint(t, cast(int32_t, j))) && !tvisnil(tv)) { | 583 | while ((tv = lj_tab_getint(t, (int32_t)j)) && !tvisnil(tv)) { |
584 | i = j; | 584 | i = j; |
585 | j *= 2; | 585 | j *= 2; |
586 | if (j > (MSize)(INT_MAX-2)) { /* overflow? */ | 586 | if (j > (MSize)(INT_MAX-2)) { /* overflow? */ |
587 | /* table was built with bad purposes: resort to linear search */ | 587 | /* table was built with bad purposes: resort to linear search */ |
588 | i = 1; | 588 | i = 1; |
589 | while ((tv = lj_tab_getint(t, cast(int32_t, i))) && !tvisnil(tv)) i++; | 589 | while ((tv = lj_tab_getint(t, (int32_t)i)) && !tvisnil(tv)) i++; |
590 | return i - 1; | 590 | return i - 1; |
591 | } | 591 | } |
592 | } | 592 | } |
593 | /* now do a binary search between them */ | 593 | /* now do a binary search between them */ |
594 | while (j - i > 1) { | 594 | while (j - i > 1) { |
595 | MSize m = (i+j)/2; | 595 | MSize m = (i+j)/2; |
596 | cTValue *tvb = lj_tab_getint(t, cast(int32_t, m)); | 596 | cTValue *tvb = lj_tab_getint(t, (int32_t)m); |
597 | if (tvb && !tvisnil(tvb)) i = m; else j = m; | 597 | if (tvb && !tvisnil(tvb)) i = m; else j = m; |
598 | } | 598 | } |
599 | return i; | 599 | return i; |