Skip to content

Commit

Permalink
Reformat b2nd files from 4 spaces indents to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargm98 authored and FrancescAlted committed Jan 25, 2023
1 parent f5fad7e commit 4489a08
Show file tree
Hide file tree
Showing 43 changed files with 5,747 additions and 5,720 deletions.
110 changes: 55 additions & 55 deletions examples/b2nd/example_frame_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ int frame_generator(int8_t *data, int8_t ndim, int64_t *shape, int32_t *chunksha
}

int rand_() {
int ndim = 3;
int typesize = 4;
int64_t shape[] = {32, 18, 32};
int32_t chunkshape[] = {17, 16, 24};
int32_t blockshape[] = {8, 9, 8};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int)(shape[i]);
}
int64_t size = typesize * nelem;
float *data = malloc(size);
for (int64_t i = 0; i < nelem; i++) {
data[i] = (float) (rand() % 220);
}
char *urlpath = "rand.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));
int ndim = 3;
int typesize = 4;
int64_t shape[] = {32, 18, 32};
int32_t chunkshape[] = {17, 16, 24};
int32_t blockshape[] = {8, 9, 8};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int) (shape[i]);
}
int64_t size = typesize * nelem;
float *data = malloc(size);
for (int64_t i = 0; i < nelem; i++) {
data[i] = (float) (rand() % 220);
}
char *urlpath = "rand.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));

return 0;
return 0;
}

int all_eq() {
Expand Down Expand Up @@ -100,49 +100,49 @@ int cyclic() {
}

int same_cells() {
int ndim = 2;
int typesize = 8;
int64_t shape[] = {128, 111};
int32_t chunkshape[] = {32, 11};
int32_t blockshape[] = {16, 7};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int)(shape[i]);
}
int64_t size = typesize * nelem;
double *data = malloc(size);
for (int64_t i = 0; i < (nelem / 4); i++) {
data[i * 4] = (double ) 11111111;
data[i * 4 + 1] = (double ) 99999999;
}
char *urlpath = "same_cells.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));
int ndim = 2;
int typesize = 8;
int64_t shape[] = {128, 111};
int32_t chunkshape[] = {32, 11};
int32_t blockshape[] = {16, 7};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int) (shape[i]);
}
int64_t size = typesize * nelem;
double *data = malloc(size);
for (int64_t i = 0; i < (nelem / 4); i++) {
data[i * 4] = (double) 11111111;
data[i * 4 + 1] = (double) 99999999;
}
char *urlpath = "same_cells.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));

return 0;
return 0;
}

int some_matches() {
int ndim = 2;
int typesize = 8;
int64_t shape[] = {128, 111};
int32_t chunkshape[] = {48, 32};
int32_t blockshape[] = {14, 18};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int)(shape[i]);
}
int64_t size = typesize * nelem;
double *data = malloc(size);
for (int64_t i = 0; i < (nelem / 2); i++) {
data[i] = (double ) i;
}
for (int64_t i = (nelem / 2); i < nelem; i++) {
data[i] = (double ) 1;
}
char *urlpath = "some_matches.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));
int ndim = 2;
int typesize = 8;
int64_t shape[] = {128, 111};
int32_t chunkshape[] = {48, 32};
int32_t blockshape[] = {14, 18};
int64_t nelem = 1;
for (int i = 0; i < ndim; ++i) {
nelem *= (int) (shape[i]);
}
int64_t size = typesize * nelem;
double *data = malloc(size);
for (int64_t i = 0; i < (nelem / 2); i++) {
data[i] = (double) i;
}
for (int64_t i = (nelem / 2); i < nelem; i++) {
data[i] = (double) 1;
}
char *urlpath = "some_matches.b2nd";
BLOSC_ERROR(frame_generator((int8_t *) data, ndim, shape, chunkshape, blockshape, typesize, size, urlpath));

return 0;
return 0;
}

int many_matches() {
Expand Down
11 changes: 6 additions & 5 deletions plugins/codecs/ndlz/ndlz-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#ifndef NDLZ_PRIVATE_H
#define NDLZ_PRIVATE_H

#include "context.h"

#if defined (__cplusplus)
Expand All @@ -20,11 +21,11 @@ extern "C" {
#define XXH_INLINE_ALL

#define NDLZ_ERROR_NULL(pointer) \
do { \
if ((pointer) == NULL) { \
return 0; \
} \
} while (0)
do { \
if ((pointer) == NULL) { \
return 0; \
} \
} while (0)


#if defined (__cplusplus)
Expand Down
60 changes: 30 additions & 30 deletions plugins/codecs/ndlz/ndlz.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@
#include "ndlz8x8.h"

int ndlz_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len,
uint8_t meta, blosc2_cparams *cparams, const void* chunk) {
NDLZ_ERROR_NULL(input);
NDLZ_ERROR_NULL(output);
NDLZ_ERROR_NULL(cparams);
BLOSC_UNUSED_PARAM(chunk);

switch (meta) {
case 4:
return ndlz4_compress(input, input_len, output, output_len, meta, cparams);
case 8:
return ndlz8_compress(input, input_len, output, output_len, meta, cparams);
default:
printf("\n NDLZ is not available for this cellsize \n");
return 0;
}
uint8_t meta, blosc2_cparams *cparams, const void *chunk) {
NDLZ_ERROR_NULL(input);
NDLZ_ERROR_NULL(output);
NDLZ_ERROR_NULL(cparams);
BLOSC_UNUSED_PARAM(chunk);

switch (meta) {
case 4:
return ndlz4_compress(input, input_len, output, output_len, meta, cparams);
case 8:
return ndlz8_compress(input, input_len, output, output_len, meta, cparams);
default:
printf("\n NDLZ is not available for this cellsize \n");
return 0;
}
}

int ndlz_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len,
uint8_t meta, blosc2_dparams *dparams, const void* chunk) {
NDLZ_ERROR_NULL(input);
NDLZ_ERROR_NULL(output);
NDLZ_ERROR_NULL(dparams);
BLOSC_UNUSED_PARAM(chunk);

switch (meta) {
case 4:
return ndlz4_decompress(input, input_len, output, output_len, meta, dparams);
case 8:
return ndlz8_decompress(input, input_len, output, output_len, meta, dparams);
default:
printf("\n NDLZ is not available for this cellsize \n");
return 0;
}
uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
NDLZ_ERROR_NULL(input);
NDLZ_ERROR_NULL(output);
NDLZ_ERROR_NULL(dparams);
BLOSC_UNUSED_PARAM(chunk);

switch (meta) {
case 4:
return ndlz4_decompress(input, input_len, output, output_len, meta, dparams);
case 8:
return ndlz8_decompress(input, input_len, output, output_len, meta, dparams);
default:
printf("\n NDLZ is not available for this cellsize \n");
return 0;
}
}
4 changes: 2 additions & 2 deletions plugins/codecs/ndlz/ndlz.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ extern "C" {
#endif

int ndlz_compress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len,
uint8_t meta, blosc2_cparams *cparams, const void* chunk);
uint8_t meta, blosc2_cparams *cparams, const void* chunk);

int ndlz_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len,
uint8_t meta, blosc2_dparams *dparams, const void* chunk);
uint8_t meta, blosc2_dparams *dparams, const void* chunk);

#if defined (__cplusplus)
}
Expand Down
Loading

0 comments on commit 4489a08

Please sign in to comment.