Commit cc72acdd authored by Julien Muchembled's avatar Julien Muchembled

Add version()

parent 814268cd
...@@ -16,6 +16,7 @@ cdef extern from "Python.h": ...@@ -16,6 +16,7 @@ cdef extern from "Python.h":
cdef extern from "zstd.h": cdef extern from "zstd.h":
# To simplify implementation, we use signed types (and detect errors with # To simplify implementation, we use signed types (and detect errors with
# negative values). Anyway, that's what `bytes` uses for its length. # negative values). Anyway, that's what `bytes` uses for its length.
int ZSTD_versionNumber()
ssize_t ZSTD_compressBound(ssize_t srcSize) ssize_t ZSTD_compressBound(ssize_t srcSize)
const char * ZSTD_getErrorName(ssize_t code) const char * ZSTD_getErrorName(ssize_t code)
int ZSTD_maxCLevel() int ZSTD_maxCLevel()
...@@ -26,6 +27,14 @@ cdef extern from "zstd.h": ...@@ -26,6 +27,14 @@ cdef extern from "zstd.h":
ssize_t ZSTD_decompress(void *dst, ssize_t dstCapacity, ssize_t ZSTD_decompress(void *dst, ssize_t dstCapacity,
const void *src, ssize_t compressedSize) nogil const void *src, ssize_t compressedSize) nogil
def version():
cdef int x = ZSTD_versionNumber()
cdef int r = x % 100
x /= 100
return x / 100, x % 100, r
version = version()
def maxCLevel(): def maxCLevel():
return ZSTD_maxCLevel() return ZSTD_maxCLevel()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment