Replace divisions with simpler code.

This commit is contained in:
Mike Pall
2012-08-26 19:41:35 +02:00
parent cf3a263044
commit c0efa6f00e
2 changed files with 14 additions and 11 deletions

View File

@@ -324,7 +324,7 @@ static void bcwrite_proto(BCWriteCtx *ctx, GCproto *pt)
/* Pass buffer to writer function. */
if (ctx->status == 0) {
MSize n = ctx->sb.n - 5;
MSize nn = 1 + lj_fls(n)/7;
MSize nn = (lj_fls(n)+8)*9 >> 6;
ctx->sb.n = 5 - nn;
bcwrite_uleb128(ctx, n); /* Fill in final size. */
lua_assert(ctx->sb.n == 5);