Utility functions#

Timing functions#

void blosc_set_timestamp(blosc_timestamp_t *timestamp)#
double blosc_elapsed_nsecs(blosc_timestamp_t start_time, blosc_timestamp_t end_time)#
double blosc_elapsed_secs(blosc_timestamp_t start_time, blosc_timestamp_t end_time)#

File and directory utilities#

int blosc2_remove_dir(const char *path)#
int blosc2_remove_urlpath(const char *path)#
int blosc2_rename_urlpath(char *old_urlpath, char *new_path)#

Slice utilities#

int64_t blosc2_get_slice_nchunks(blosc2_schunk *schunk, int64_t *start, int64_t *stop, int64_t **chunks_idx)#
void blosc2_unidim_to_multidim(uint8_t ndim, int64_t *shape, int64_t i, int64_t *index)#
void blosc2_multidim_to_unidim(const int64_t *index, int8_t ndim, const int64_t *strides, int64_t *i)#

Shuffle and bitshuffle#

int32_t blosc2_shuffle(const int32_t typesize, const int32_t blocksize, const void *src, void *dest)#

Applies the shuffle operation to a block of data in src, and puts the result in dest.

Parameters:
  • typesize – Is the number of bytes for the atomic type in binary src buffer. Only 1 < typesize < 256 is allowed.

  • blocksize – The size of the block.

  • src – The source buffer to be shuffled.

  • dest – The destination buffer where the shuffled data will be written.

Returns:

blocksize on success or a negative value if some error happens (mainly an invalid parameter).

Warning

The src buffer and the dest buffer can not overlap.

int32_t blosc2_unshuffle(const int32_t typesize, const int32_t blocksize, const void *src, void *dest)#

Applies the inverse shuffle operation to a block of data in src, and puts the result in dest.

Parameters:
  • typesize – Is the number of bytes for the atomic type in binary src buffer. Only 1 < typesize < 256 is allowed.

  • blocksize – The size of the block.

  • src – The source buffer to be unshuffled.

  • dest – The destination buffer where the unshuffled data will be written.

Returns:

blocksize on success or a negative value if some error happens (mainly an invalid parameter).

Warning

The src buffer and the dest buffer can not overlap.

int32_t blosc2_bitshuffle(const int32_t typesize, const int32_t blocksize, const void *src, void *dest)#

Applies the bitshuffle operation to a block of data in src, and puts the result in dest.

Remark

The function will shuffle the maximum amount of elements that can be divided by 8, and copy the rest to the destination buffer unchanged. There are blocksize / typesize elements.

Parameters:
  • typesize – Is the number of bytes for the atomic type in binary src buffer. Only 1 < typesize < 256 is allowed.

  • blocksize – The size of the block.

  • src – The source buffer to be shuffled.

  • dest – The destination buffer where the shuffled data will be written.

Returns:

blocksize on success or a negative value if some error happens (mainly an invalid parameter).

Warning

The src buffer and the dest buffer can not overlap.

int32_t blosc2_bitunshuffle(const int32_t typesize, const int32_t blocksize, const void *src, void *dest)#

Applies the inverse bitshuffle operation to a block of data in src, and puts the result in dest.

Remark

The function will shuffle the maximum amount of elements that can be divided by 8, and copy the rest to the destination buffer unchanged. There are blocksize / typesize elements.

Parameters:
  • typesize – Is the number of bytes for the atomic type in binary src buffer. Only 1 < typesize < 256 is allowed.

  • blocksize – The size of the block.

  • src – The source buffer to be unshuffled.

  • dest – The destination buffer where the unshuffled data will be written.

Returns:

blocksize on success or a negative value if some error happens (mainly an invalid parameter).

Warning

The src buffer and the dest buffer can not overlap.