Skip to content

Commit 3bc4247

Browse files
authored
Merge pull request #1 from kstppd/patch_macos
Change uint64_t to size_t for compilation on mac os using clang
2 parents ee1b385 + 93b14e6 commit 3bc4247

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

toctree.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,14 +1195,14 @@ struct SerialTucker {
11951195

11961196
std::vector<atomic_coord_type> leaf_coordinates;
11971197
std::vector<uint8_t> leaf_levels;
1198-
uint64_t core_size;
1198+
std::size_t core_size;
11991199

12001200
T core_scale = 0;
12011201
size_t n_core;
12021202

12031203
indexrange<L, N> root_range;
12041204

1205-
uint64_t packed_size;
1205+
std::size_t packed_size;
12061206
std::vector<uint8_t> packed;
12071207

12081208
void make_serialized_bytes() {
@@ -1398,7 +1398,7 @@ struct SerialTucker {
13981398
pod.leaf_coordinates = this->leaf_coordinates.data();
13991399
pod.n_leaf_coordinates = this->leaf_coordinates.size();
14001400
pod.leaf_levels = this->leaf_levels.data();
1401-
pod.core_size = uint64_t(this->core_size);
1401+
pod.core_size = std::size_t(this->core_size);
14021402
pod.bytes_per_leaf_coordinate = sizeof(atomic_coord_type);
14031403
pod.core_scale = this->core_scale;
14041404

@@ -1522,7 +1522,7 @@ void print_compressed_toctree_t(compressed_toctree_t pod)
15221522

15231523
}
15241524

1525-
void compressed_toctree_t_to_bytes(compressed_toctree_t pod, uint8_t **bytes, uint64_t* n_bytes) {
1525+
void compressed_toctree_t_to_bytes(compressed_toctree_t pod, uint8_t **bytes, std::size_t* n_bytes) {
15261526

15271527
ptrdiff_t acc;
15281528

@@ -1576,7 +1576,7 @@ void compressed_toctree_t_to_bytes(compressed_toctree_t pod, uint8_t **bytes, ui
15761576
#undef copy_atomic
15771577
}
15781578

1579-
compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, uint64_t n_packed)
1579+
compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, std::size_t n_packed)
15801580
{
15811581

15821582
#define stof(X) sizeof(typeof(X))
@@ -1600,16 +1600,16 @@ compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, uint64_t n_pac
16001600
}
16011601
printacc;
16021602

1603-
pod.n_packed_bytes = *(uint64_t*)(data+acc);
1603+
pod.n_packed_bytes = *(std::size_t*)(data+acc);
16041604
acc = acc+stof(pod.n_packed_bytes);
16051605
printacc;
16061606

16071607
pod.packed_bytes = (uint8_t*)(data+acc);
16081608
acc = acc+pod.n_packed_bytes*stofp(pod.packed_bytes);
16091609
printacc;
16101610

1611-
pod.n_serialized = *(uint64_t*)(data+acc);
1612-
acc = acc+sizeof(uint64_t);
1611+
pod.n_serialized = *(std::size_t*)(data+acc);
1612+
acc = acc+sizeof(std::size_t);
16131613
printacc;
16141614

16151615
pod.n_leaf_coordinates = *(uint32_t*)(data+acc);
@@ -1624,7 +1624,7 @@ compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, uint64_t n_pac
16241624
acc = acc + pod.n_leaf_coordinates*stofp(pod.leaf_levels);
16251625
printacc;
16261626

1627-
pod.core_size = *(uint64_t*)(data+acc);
1627+
pod.core_size = *(std::size_t*)(data+acc);
16281628
acc = acc+sizeof(typeof(pod.core_size));
16291629
printacc;
16301630

@@ -1653,9 +1653,9 @@ int compress_with_toctree_method(VDF_REAL_DTYPE* buffer,
16531653
const size_t Nx, const size_t Ny, const size_t Nz,
16541654
VDF_REAL_DTYPE tolerance,
16551655
uint8_t** serialized_buffer,
1656-
uint64_t* serialized_buffer_size,
1657-
uint64_t maxiter,
1658-
uint64_t skip_levels)
1656+
std::size_t* serialized_buffer_size,
1657+
std::size_t maxiter,
1658+
std::size_t skip_levels)
16591659
{
16601660
using namespace Eigen;
16611661
using namespace tree_compressor;
@@ -1745,7 +1745,7 @@ int compress_with_toctree_method(VDF_REAL_DTYPE* buffer,
17451745
}
17461746

17471747
void uncompress_with_toctree_method(VDF_REAL_DTYPE* buffer, const size_t Nx, const size_t Ny, const size_t Nz,
1748-
uint8_t* serialized_buffer, uint64_t serialized_buffer_size) {
1748+
uint8_t* serialized_buffer, std::size_t serialized_buffer_size) {
17491749
using namespace Eigen;
17501750
using namespace tree_compressor;
17511751

@@ -1777,9 +1777,9 @@ void compress_with_toctree_method_2d(VDF_REAL_DTYPE* buffer,
17771777
const size_t Nx, const size_t Ny,
17781778
VDF_REAL_DTYPE tolerance,
17791779
uint8_t** serialized_buffer,
1780-
uint64_t* serialized_buffer_size,
1781-
uint64_t maxiter,
1782-
uint64_t skip_levels)
1780+
std::size_t* serialized_buffer_size,
1781+
std::size_t maxiter,
1782+
std::size_t skip_levels)
17831783
{
17841784
using namespace Eigen;
17851785
using namespace tree_compressor;
@@ -1871,7 +1871,7 @@ void compress_with_toctree_method_2d(VDF_REAL_DTYPE* buffer,
18711871
}
18721872

18731873
void uncompress_with_toctree_method_2d(VDF_REAL_DTYPE* buffer, const size_t Nx, const size_t Ny,
1874-
uint8_t* serialized_buffer, uint64_t serialized_buffer_size) {
1874+
uint8_t* serialized_buffer, std::size_t serialized_buffer_size) {
18751875
using namespace Eigen;
18761876
using namespace tree_compressor;
18771877

toctree_compressor.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,32 @@ typedef struct {
6464
uint8_t n_root_dims;
6565

6666
uint8_t* packed_bytes;
67-
uint64_t n_packed_bytes;
67+
std::size_t n_packed_bytes;
6868

69-
uint64_t n_serialized;
69+
std::size_t n_serialized;
7070

7171
ATOMIC_OCTREE_COORDINATE_DTYPE* leaf_coordinates;
7272
uint32_t n_leaf_coordinates;
7373

7474
uint8_t* leaf_levels;
75-
uint64_t core_size;
75+
std::size_t core_size;
7676
uint8_t bytes_per_leaf_coordinate;
7777
VDF_REAL_DTYPE core_scale;
7878
} compressed_toctree_t;
7979

8080
void print_compressed_toctree_t(compressed_toctree_t pod);
8181

82-
void compressed_toctree_t_to_bytes(compressed_toctree_t pod, uint8_t **bytes, uint64_t* n_bytes);
82+
void compressed_toctree_t_to_bytes(compressed_toctree_t pod, uint8_t **bytes, std::size_t* n_bytes);
8383

84-
compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, uint64_t n_packed);
84+
compressed_toctree_t bytes_to_compressed_toctree_t(uint8_t* data, std::size_t n_packed);
8585

8686
int compress_with_toctree_method(VDF_REAL_DTYPE* buffer,
8787
const size_t Nx, const size_t Ny, const size_t Nz,
8888
VDF_REAL_DTYPE tolerance, uint8_t** serialized_buffer,
89-
uint64_t* serialized_buffer_size, uint64_t maxiter, uint64_t skip_levels);
89+
std::size_t* serialized_buffer_size, std::size_t maxiter, std::size_t skip_levels);
9090

9191
void uncompress_with_toctree_method(VDF_REAL_DTYPE* buffer, const size_t Nx, const size_t Ny, const size_t Nz,
92-
uint8_t* serialized_buffer, uint64_t serialized_buffer_size);
92+
uint8_t* serialized_buffer, std::size_t serialized_buffer_size);
9393

9494
}
9595
#endif

0 commit comments

Comments
 (0)