//go:build windows

package yu_deflate

import (
	"runtime"
	"sync"
)

// const (
//	LevelMin        = 1
//	LevelMaxStdZlib = 9
//	LevelMax        = 12
//	LevelDefault    = 6
// )

var m_pool_comp = sync.Pool{
	New: func() any {
		t := new(uintptr)
		runtime.SetFinalizer(t, pool_comp_finalizer)
		*t, _, _ = libdeflate_alloc_compressor.Call(12)
		return t
	},
}

func pool_comp_finalizer(t *uintptr) {
	libdeflate_free_compressor.Call(*t)
}

var m_pool_decomp = sync.Pool{
	New: func() any {
		t := new(uintptr)
		runtime.SetFinalizer(t, pool_decomp_finalizer)
		*t, _, _ = libdeflate_alloc_decompressor.Call()
		return t
	},
}

func pool_decomp_finalizer(t *uintptr) {
	libdeflate_free_decompressor.Call(*t)
}
