1212#include "../../mods/number/lib/num/struct.h"
1313#include "../../mods/number/header.h"
1414
15- #include "../split/header.h"
16-
1715
1816
1917#ifdef DEBUG
2826
2927
3028
31- void triplet_join (
29+ void binary_split_join (
3230 sig_num_t out [3 ],
3331 sig_num_t res_1 [3 ],
3432 sig_num_t res_2 [3 ]
@@ -47,7 +45,7 @@ void triplet_join(
4745}
4846
4947// out vector length 3, returns P, Q, R in that order
50- void triplet_calculate (sig_num_t out [3 ], uint64_t i_0 , uint64_t span )
48+ void binary_split (sig_num_t out [3 ], uint64_t i_0 , uint64_t span )
5149{
5250 if (span == 0 )
5351 {
@@ -63,44 +61,44 @@ void triplet_calculate(sig_num_t out[3], uint64_t i_0, uint64_t span)
6361 }
6462
6563 sig_num_t res_1 [3 ], res_2 [3 ];
66- triplet_calculate (res_1 , i_0 , span - 1 );
67- triplet_calculate (res_2 , i_0 + B (span - 1 ), span - 1 );
64+ split (res_1 , i_0 , span - 1 );
65+ split (res_2 , i_0 + B (span - 1 ), span - 1 );
6866 triplet_join (out , res_1 , res_2 );
6967}
7068
7169
7270
73- void triplet_path_set (char path [PATH_MAX_LEN ], uint64_t i_0 , uint64_t span )
71+ void piece_path_set (char path [PATH_MAX_LEN ], uint64_t i_0 , uint64_t span )
7472{
7573 uint64_t i_max = i_0 + B (span ) - 1 ;
7674 span = span - PIECE_SIZE ;
77- snprintf (path , PATH_MAX_LEN , CACHE "/triplet /p_" U64P (015 ) "_ " U64P(02) " _ " U64P(015) " .bin ", i_0 , span , i_max );
75+ snprintf (path , PATH_MAX_LEN , CACHE "/piece /p_" U64P (015 ) "_ " U64P(02) " _ " U64P(015) " .bin ", i_0 , span , i_max );
7876}
7977
80- void triplet_delete (uint64_t i_0 , uint64_t span )
78+ void piece_delete (uint64_t i_0 , uint64_t span )
8179{
8280 char path [PATH_MAX_LEN ];
83- triplet_path_set (path , i_0 , span );
81+ piece_path_set (path , i_0 , span );
8482 remove (path );
8583}
8684
87- FILE * triplet_try_open_read (uint64_t i_0 , uint64_t span )
85+ FILE * piece_try_open_read (uint64_t i_0 , uint64_t span )
8886{
8987 char path [PATH_MAX_LEN ];
90- triplet_path_set (path , i_0 , span );
88+ piece_path_set (path , i_0 , span );
9189 return file_read_open (path );
9290}
9391
94- file_t triplet_open_write (uint64_t i_0 , uint64_t span )
92+ file_t piece_open_write (uint64_t i_0 , uint64_t span )
9593{
9694 char path [PATH_MAX_LEN ];
97- triplet_path_set (path , i_0 , span );
95+ piece_path_set (path , i_0 , span );
9896 return file_write_open (path , 3 );
9997}
10098
101- void triplet_save (sig_num_t res [3 ], uint64_t i_0 , uint64_t span )
99+ void piece_save (sig_num_t res [3 ], uint64_t i_0 , uint64_t span )
102100{
103- file_t fp = triplet_open_write (i_0 , span );
101+ file_t fp = piece_open_write (i_0 , span );
104102 for (uint64_t i = 0 ; i < 3 ; i ++ )
105103 {
106104 file_write_sig_num (& fp , res [i ]);
@@ -110,9 +108,9 @@ void triplet_save(sig_num_t res[3], uint64_t i_0, uint64_t span)
110108 file_write_close (& fp );
111109}
112110
113- bool triplet_try_load (sig_num_p out , uint64_t i_0 , uint64_t span , uint64_t index )
111+ bool piece_try_load (sig_num_p out , uint64_t i_0 , uint64_t span , uint64_t index )
114112{
115- FILE * fp = triplet_try_open_read (i_0 , span );
113+ FILE * fp = piece_try_open_read (i_0 , span );
116114 if (fp == NULL )
117115 return false;
118116
@@ -121,16 +119,16 @@ bool triplet_try_load(sig_num_p out, uint64_t i_0, uint64_t span, uint64_t index
121119 return true;
122120}
123121
124- sig_num_t triplet_load (uint64_t i_0 , uint64_t span , uint64_t index )
122+ sig_num_t piece_load (uint64_t i_0 , uint64_t span , uint64_t index )
125123{
126124 sig_num_t res ;
127- assert (triplet_try_load (& res , i_0 , span , index ));
125+ assert (piece_try_load (& res , i_0 , span , index ));
128126 return res ;
129127}
130128
131- bool triplet_is_stored (uint64_t i_0 , uint64_t span )
129+ bool piece_is_stored (uint64_t i_0 , uint64_t span )
132130{
133- FILE * fp = triplet_try_open_read (i_0 , span );
131+ FILE * fp = piece_try_open_read (i_0 , span );
134132 if (fp == NULL )
135133 return false;
136134
@@ -139,7 +137,7 @@ bool triplet_is_stored(uint64_t i_0, uint64_t span)
139137}
140138
141139// Get the size of the first number
142- uint64_t triplet_get_size (uint64_t i_0 , uint64_t span , uint64_t index )
140+ uint64_t piece_get_size (uint64_t i_0 , uint64_t span , uint64_t index )
143141{
144142 FILE * fp = triplet_try_open_read (i_0 , span );
145143 assert (fp );
@@ -187,22 +185,6 @@ file_t slice_open_write(uint64_t size, uint64_t i_0, uint64_t remainder, uint64_
187185 return file_write_open (path , 1 );
188186}
189187
190- union_num_t slice_load (
191- uint64_t size ,
192- uint64_t i_0 ,
193- uint64_t remainder ,
194- uint64_t depth ,
195- uint64_t index
196- )
197- {
198- FILE * fp = slice_try_open_read (size , i_0 , remainder , depth );
199- assert (fp );
200-
201- union_num_t u = file_read_union_num (fp , index );
202- fclose (fp );
203- return u ;
204- }
205-
206188bool slice_is_stored (uint64_t size , uint64_t i_0 , uint64_t remainder , uint64_t depth )
207189{
208190 FILE * fp = slice_try_open_read (size , i_0 , remainder , depth );
@@ -323,23 +305,6 @@ void split_span(uint64_t size, uint64_t i_0, uint64_t span, uint64_t depth)
323305
324306
325307
326- union_num_t split_big_res_load (
327- uint64_t size ,
328- uint64_t i_0 ,
329- uint64_t remainder ,
330- uint64_t depth ,
331- uint64_t index
332- )
333- {
334- if (stdc_count_ones (remainder ) == 1 )
335- {
336- uint64_t span = stdc_bit_width (remainder ) - 1 ;
337- return split_span_res_load (size , i_0 , span , depth , index );
338- }
339-
340- return union_res_load (size , i_0 , remainder , depth , index );
341- }
342-
343308bool split_big_res_is_stored (
344309 uint64_t size ,
345310 uint64_t i_0 ,
0 commit comments