Merge "Convert to int before adding negative numbers" into nextgenv2
diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c
index d005438..f5a0aa5 100644
--- a/av1/encoder/lookahead.c
+++ b/av1/encoder/lookahead.c
@@ -213,8 +213,8 @@
   } else if (index < 0) {
     // Backward peek
     if (-index <= MAX_PRE_FRAMES) {
-      index += ctx->read_idx;
-      if (index < 0) index += ctx->max_sz;
+      index += (int)(ctx->read_idx);
+      if (index < 0) index += (int)(ctx->max_sz);
       buf = ctx->buf + index;
     }
   }