1 /* 2 * Copyright (C) 2018-present Francesc Alted, Aleix Alcacer. 3 * Copyright (C) 2019-present Blosc Development team <blosc@blosc.org> 4 * All rights reserved. 5 * 6 * This source code is licensed under both the BSD-style license (found in the 7 * LICENSE file in the root directory of this source tree) and the GPLv2 (found 8 * in the COPYING file in the root directory of this source tree). 9 * You may select, at your option, one of the above-listed licenses. 10 */ 11 12 #ifndef CATERVA_CATERVA_UTILS_H_ 13 #define CATERVA_CATERVA_UTILS_H_ 14 15 #include <caterva.h> 16 17 void index_unidim_to_multidim(int8_t ndim, int64_t *shape, int64_t i, int64_t *index); 18 void index_multidim_to_unidim(int64_t *index, int8_t ndim, int64_t *strides, int64_t *i); 19 20 int32_t serialize_meta(uint8_t ndim, int64_t *shape, const int32_t *chunkshape, 21 const int32_t *blockshape, uint8_t **smeta); 22 int32_t deserialize_meta(uint8_t *smeta, uint32_t smeta_len, uint8_t *ndim, int64_t *shape, 23 int32_t *chunkshape, int32_t *blockshape); 24 25 void swap_store(void *dest, const void *pa, int size); 26 27 int caterva_copy_buffer(uint8_t ndim, 28 uint8_t itemsize, 29 void *src, int64_t *src_pad_shape, 30 int64_t *src_start, int64_t *src_stop, 31 void *dst, int64_t *dst_pad_shape, 32 int64_t *dst_start); 33 34 int create_blosc_params(caterva_ctx_t *ctx, 35 caterva_params_t *params, 36 caterva_storage_t *storage, 37 blosc2_cparams *cparams, 38 blosc2_dparams *dparams, 39 blosc2_storage *b_storage); 40 41 int caterva_config_from_schunk(caterva_ctx_t *ctx, blosc2_schunk *sc, caterva_config_t *cfg); 42 43 #endif // CATERVA_CATERVA_UTILS_H_ 44