void
lzms_init_slots(void)
{
- static bool done = false;
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
- if (unlikely(!done)) {
- pthread_mutex_lock(&mutex);
- if (!done) {
- lzms_compute_slots();
- done = true;
- }
- pthread_mutex_unlock(&mutex);
- }
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+ pthread_once(&once, lzms_compute_slots);
}
static s32
for (s32 i = 0; i < 65536; i++)
last_target_usages[i] = -LZMS_X86_MAX_GOOD_TARGET_OFFSET - 1;
- for (s32 i = 0; i < size - 11; ) {
+ for (s32 i = 0; i < size - 16; ) {
s32 max_trans_offset;
s32 n;