Skip to content

Commit 567382b

Browse files
authored
Fix off-by-one in power of 2 calculation (#42)
1 parent 666774d commit 567382b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void twin_path_arc(twin_path_t *path,
211211
sides = 1024;
212212

213213
/* Calculate the nearest power of 2 that is >= sides. */
214-
int32_t n = (sides > 1) ? (31 - twin_clz(sides - 1) + 1) : 2;
214+
int32_t n = (sides > 1) ? (31 - twin_clz(sides) + 1) : 2;
215215

216216
twin_angle_t step = TWIN_ANGLE_360 >> n;
217217
twin_angle_t inc = step;

0 commit comments

Comments
 (0)