MCPcopy Create free account
hub / github.com/dds-bridge/dds / init

Method init

library/src/trans_table/trans_table_l.cpp:234–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234auto TransTableL::init(const int hand_lookup[][15]) -> void
235{
236 // This is very similar to SetConstants, except that it
237 // happens with actual cards. It also makes sense to
238 // keep a record of aggr_ranks_ for each suit. These are
239 // only used later for xor_set_.
240
241 unsigned int top_bit_rank = 1;
242 unsigned int top_bit_no = 2;
243 Aggr * ap;
244
245 for (int s = 0; s < DDS_SUITS; s++) {
246 aggr_[0].aggr_ranks_[s] = 0;
247 aggr_[0].aggr_bytes_[s][0] = 0;
248 aggr_[0].aggr_bytes_[s][1] = 0;
249 aggr_[0].aggr_bytes_[s][2] = 0;
250 aggr_[0].aggr_bytes_[s][3] = 0;
251 }
252
253 for (unsigned ind = 1; ind < 8192; ind++) {
254 if (ind >= (top_bit_rank << 1)) {
255 /* Next top bit */
256 top_bit_rank <<= 1;
257 top_bit_no++;
258 }
259
260 aggr_[ind] = aggr_[ind ^ top_bit_rank];
261 ap = &aggr_[ind];
262
263 for (int s = 0; s < DDS_SUITS; s++) {
264 ap->aggr_ranks_[s] = (ap->aggr_ranks_[s] >> 2) |
265 static_cast<unsigned>(hand_lookup[s][top_bit_no] << 24);
266 }
267
268 ap->aggr_bytes_[0][0] = (ap->aggr_ranks_[0] << 6) & 0xff000000;
269 ap->aggr_bytes_[0][1] = (ap->aggr_ranks_[0] << 14) & 0xff000000;
270 ap->aggr_bytes_[0][2] = (ap->aggr_ranks_[0] << 22) & 0xff000000;
271 ap->aggr_bytes_[0][3] = (ap->aggr_ranks_[0] << 30) & 0xff000000;
272
273 ap->aggr_bytes_[1][0] = (ap->aggr_ranks_[1] >> 2) & 0x00ff0000;
274 ap->aggr_bytes_[1][1] = (ap->aggr_ranks_[1] << 6) & 0x00ff0000;
275 ap->aggr_bytes_[1][2] = (ap->aggr_ranks_[1] << 14) & 0x00ff0000;
276 ap->aggr_bytes_[1][3] = (ap->aggr_ranks_[1] << 22) & 0x00ff0000;
277
278 ap->aggr_bytes_[2][0] = (ap->aggr_ranks_[2] >> 10) & 0x0000ff00;
279 ap->aggr_bytes_[2][1] = (ap->aggr_ranks_[2] >> 2) & 0x0000ff00;
280 ap->aggr_bytes_[2][2] = (ap->aggr_ranks_[2] << 6) & 0x0000ff00;
281 ap->aggr_bytes_[2][3] = (ap->aggr_ranks_[2] << 14) & 0x0000ff00;
282
283 ap->aggr_bytes_[3][0] = (ap->aggr_ranks_[3] >> 18) & 0x000000ff;
284 ap->aggr_bytes_[3][1] = (ap->aggr_ranks_[3] >> 10) & 0x000000ff;
285 ap->aggr_bytes_[3][2] = (ap->aggr_ranks_[3] >> 2) & 0x000000ff;
286 ap->aggr_bytes_[3][3] = (ap->aggr_ranks_[3] << 6) & 0x000000ff;
287 }
288}
289
290
291auto TransTableL::set_memory_default(int megabytes) -> void

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected