mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Guard against unlikely overflow
This commit is contained in:
@@ -69,6 +69,11 @@ void init_cpus() {
|
|||||||
CPUS = 1;
|
CPUS = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Guard against short struct index.segment
|
||||||
|
if (CPUS > 32767) {
|
||||||
|
CPUS = 32767;
|
||||||
|
}
|
||||||
|
|
||||||
// Round down to a power of 2
|
// Round down to a power of 2
|
||||||
CPUS = 1 << (int) (log(CPUS) / log(2));
|
CPUS = 1 << (int) (log(CPUS) / log(2));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user