Z-Data 0.8.3.0 → 0.8.4.0
raw patch · 5 files changed
+25/−16 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Z.Data.Vector: arrVec :: Vec v a => IArray v a -> v a
+ Z.Data.Vector: arrVec :: (Vec v a, Vec u a, IArray v ~ IArray u) => v a -> u a
- Z.Data.Vector.Base: arrVec :: Vec v a => IArray v a -> v a
+ Z.Data.Vector.Base: arrVec :: (Vec v a, Vec u a, IArray v ~ IArray u) => v a -> u a
Files
- ChangeLog.md +5/−0
- Z-Data.cabal +2/−1
- Z/Data/Vector/Base.hs +3/−3
- cbits/bytes.c +2/−2
- third_party/Turbo-Base64/turbob64sse.c +13/−10
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for Z-Data +## 0.8.4.0 -- 2021-06-03++* `arrVec` from `Z.Data.Vector` now could convert between vector(array slice) and array back and forth.+* Fix a CPP bug in `no-avx` build flag.+ ## 0.8.3.0 -- 2021-06-02 * Fix numeric literals' `Print` instances when precedence > 6 and value < 0.
Z-Data.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: Z-Data-version: 0.8.3.0+version: 0.8.4.0 synopsis: Array, vector and text description: This package provides array, slice and text operations license: BSD-3-Clause@@ -242,6 +242,7 @@ third_party/Turbo-Base64/turbob64c.c third_party/Turbo-Base64/turbob64d.c third_party/Turbo-Base64/turbob64sse.c+ -- third_party/Turbo-Base64/turbob64avx2.c, this file is conditionally included from bytes.c third_party/utf8rewind/source/internal/casemapping.c third_party/utf8rewind/source/internal/codepoint.c third_party/utf8rewind/source/internal/composition.c
Z/Data/Vector/Base.hs view
@@ -135,10 +135,10 @@ -- | Create a vector by slicing an array(with offset and length). fromArr :: IArray v a -> Int -> Int -> v a --- | Construct a 'Vec' by slicing a whole array.-arrVec :: Vec v a => IArray v a -> v a+-- | Change vector types based on same array type, e.g. construct an array from a slice, or vice-versa.+arrVec :: (Vec v a, Vec u a, IArray v ~ IArray u) => v a -> u a {-# INLINE arrVec #-}-arrVec arr = fromArr arr 0 (sizeofArr arr)+arrVec bs = let (arr, s, l) = toArr bs in fromArr arr s l instance Vec Array a where type IArray Array = Array
cbits/bytes.c view
@@ -259,7 +259,7 @@ tb64avx2enc(input+off, (size_t)len, output+output_off); #elif defined(__AVX__) && !defined(NO_AVX) tb64avxenc(input+off, (size_t)len, output+output_off);-#elif defined(__SSE3__)+#elif defined(__SSSE3__) tb64sseenc(input+off, (size_t)len, output+output_off); #else tb64xenc(input+off, (size_t)len, output+output_off);@@ -271,7 +271,7 @@ return (HsInt)tb64avx2dec(input+off, (size_t)len, output); #elif defined(__AVX__) && !defined(NO_AVX) return (HsInt)tb64avxdec(input+off, (size_t)len, output);-#elif defined(__SSE3__)+#elif defined(__SSSE3__) return (HsInt)tb64ssedec(input+off, (size_t)len, output); #else return (HsInt)tb64xdec(input+off, (size_t)len, output);
third_party/Turbo-Base64/turbob64sse.c view
@@ -34,12 +34,14 @@ #include <string.h> - #if defined(__AVX__) + #if defined(__AVX__) && !defined(NO_AVX) #include <immintrin.h> -#define FUNPREF tb64avx +#define FUNPREF_ENC tb64avxenc +#define FUNPREF_DEC tb64avxdec #elif defined(__SSE4_1__) #include <smmintrin.h> -#define FUNPREF tb64sse +#define FUNPREF_ENC tb64sseenc +#define FUNPREF_DEC tb64ssedec #elif defined(__SSSE3__) #ifdef __powerpc64__ #define __SSE__ 1 @@ -47,7 +49,8 @@ #define __SSE3__ 1 #define NO_WARN_X86_INTRINSICS 1 #endif -#define FUNPREF tb64sse +#define FUNPREF_ENC tb64sseenc +#define FUNPREF_DEC tb64ssedec #include <tmmintrin.h> #elif defined(__SSE2__) #include <emmintrin.h> @@ -195,11 +198,11 @@ #elif defined(__SSSE3__) //----------------- SSSE3 / SSE4.1 / AVX (derived from the AVX2 functions ) ----------------------------------------------------------------- #define OVD 4 -size_t TEMPLATE2(FUNPREF, dec)(const unsigned char *in, size_t inlen, unsigned char *out) { +size_t FUNPREF_DEC(const unsigned char *in, size_t inlen, unsigned char *out) { if(inlen >= 16+OVD) { const unsigned char *ip; unsigned char *op; - #ifdef __AVX__ + #if defined(__AVX__) && !defined(NO_AVX) #define ND 64 #else #define ND 32 @@ -241,7 +244,7 @@ CHECK1(MM_B64CHK(iv3, shifted3, check_asso, check_values, vx)); #endif } - #ifdef __AVX__ + #if defined(__AVX__) && !defined(NO_AVX) for(; ip < (in+inlen)-(16+OVD); ip += 16, op += (16/4)*3) { #else if(ip < (in+inlen)-(16+OVD)) { @@ -250,7 +253,7 @@ __m128i ov0, shifted0; MM_MAP8TO6(iv0, shifted0,delta_asso, delta_values, ov0); MM_PACK8TO6(ov0, cpv); _mm_storeu_si128((__m128i*) op, ov0); CHECK1(MM_B64CHK(iv0, shifted0, check_asso, check_values, vx)); - #ifndef __AVX__ + #if defined(__AVX__) && !defined(NO_AVX) ip += 16; op += (16/4)*3; #endif } @@ -262,11 +265,11 @@ } #define OVE 8 -size_t TEMPLATE2(FUNPREF, enc)(const unsigned char* in, size_t inlen, unsigned char *out) { +size_t FUNPREF_ENC(const unsigned char* in, size_t inlen, unsigned char *out) { const unsigned char *ip = in; unsigned char *op = out; size_t outlen = TB64ENCLEN(inlen); - #ifdef __AVX__ + #if defined(__AVX__) && !defined(NO_AVX) #define NE 64 #else #define NE 32