Changeset 876 for trunk/lib


Ignore:
Timestamp:
Jan 12, 2011, 12:00:24 PM (9 years ago)
Author:
cameron
Message:

Declare that carry numbers/counts are const

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/carryQ.h

    r809 r876  
    2525for (int j=0; j < count; j++) name[j] = Carry0
    2626
    27 static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype cq, int carryno) {
     27static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype cq, const int carryno) {
    2828 BitBlock rslt;
    2929 advance_with_carry(strm, cq[carryno], rslt);
     
    3131}
    3232
    33 static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype cq, int carryno) {
     33static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype cq, const int carryno) {
    3434 BitBlock rslt;
    3535 cq[carryno] = Carry0;
     
    3838}
    3939
    40 static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, int carryno) {
     40static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    4141 BitBlock sum;
    4242 adc128(strm1, strm2, cq[carryno], sum);
     
    4444}
    4545
    46 static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, int carryno) {
     46static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    4747 BitBlock sum;
    4848 cq[carryno] = Carry0;
     
    5151}
    5252
    53 static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, int carryno) {
     53static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    5454 BitBlock diff;
    5555 sbb128(strm1, strm2, cq[carryno], diff);
     
    5757}
    5858
    59 static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, int carryno) {
     59static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    6060 BitBlock diff;
    6161 cq[carryno] = Carry0;
     
    6464}
    6565
    66 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, int carryno) {
     66static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) {
    6767 BitBlock markers1;
    6868 adc128(markers0, charclass, cq[carryno], markers1);
     
    7070}
    7171
    72 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, int carryno) {
     72static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) {
    7373 BitBlock markers1;
    7474 cq[carryno] = Carry0;
     
    7777}
    7878
    79 static inline bool CarryTest(CarryQtype cq, int carryno, int carry_count) {
     79static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) {
    8080  CarryType c1 = cq[carryno];
    8181  int i;
     
    8686}
    8787
    88 static inline void CarryDequeueEnqueue(CarryQtype cq, int carryno, int carry_count) {
     88static inline void CarryDequeueEnqueue(CarryQtype cq, const int carryno, const int carry_count) {
    8989  // Given carryin queue with carry_count carries starting from carryno are 0,
    9090  // ensure that the carryout queue has carry_count carries starting from carryno set to 0.
     
    9393}
    9494
    95 static inline void CarryQ_Adjust(CarryQtype cq, int carry_count) {
     95static inline void CarryQ_Adjust(CarryQtype cq, const int carry_count) {
    9696  // Adjust the carryQ so that carries enqueued are readied for dequeiing.
    9797  // Nothing to do with indexed queues.
     
    9999}
    100100
    101 static inline void CarryCombine(CarryQtype cq, CarryQtype local_cq, int carryno, int carry_count) {
     101static inline void CarryCombine(CarryQtype cq, CarryQtype local_cq, const int carryno, const int carry_count) {
    102102  int i;
    103103  for (i = 0; i < carry_count; i++) {
     
    182182} while(0)
    183183
    184 static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, int carryno) {
     184static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, const int carryno) {
    185185 BitBlock rslt;
    186186 carryQ_advance_with_carry_ci_co(strm, cq, rslt);
     
    188188}
    189189
    190 static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, int carryno) {
     190static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, const int carryno) {
    191191 BitBlock rslt;
    192192 carryQ_advance_with_carry_co(strm, cq, rslt);
     
    194194}
    195195
    196 static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     196static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    197197 BitBlock sum;
    198198 carryQ_adc128_ci_co(strm1, strm2, cq, sum);
     
    200200}
    201201
    202 static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     202static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    203203 BitBlock sum;
    204204 carryQ_adc128_co(strm1, strm2, cq, sum);
     
    206206}
    207207
    208 static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     208static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    209209 BitBlock diff;
    210210 carryQ_sbb128_ci_co(strm1, strm2, cq, diff);
     
    212212}
    213213
    214 static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     214static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    215215 BitBlock diff;
    216216 carryQ_sbb128_co(strm1, strm2, cq, diff);
     
    218218}
    219219
    220 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, int carryno) {
     220static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    221221 BitBlock markers1;
    222222 carryQ_adc128_ci_co(markers0, charclass, cq, markers1);
     
    224224}
    225225
    226 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, int carryno) {
     226static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    227227 BitBlock markers1;
    228228 carryQ_adc128_co(markers0, charclass, cq, markers1);
     
    232232typedef union {SIMD_type bitblock; uint64_t int64[2];} BitBlock_int64;
    233233
    234 static inline bool CarryTest(CarryQtype cq, int carryno, int carry_count) {
     234static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) {
    235235  BitBlock_int64 t;
    236236  t.bitblock = cq;
     
    239239}
    240240
    241 static inline void CarryDequeueEnqueue(CarryQtype & cq, int carryno, int carry_count) {
     241static inline void CarryDequeueEnqueue(CarryQtype & cq, const int carryno, const int carry_count) {
    242242  // Given carryin queue with carry_count carries starting from carryno are 0,
    243243  // ensure that the carryout queue has carry_count carries starting from carryno set to 0.
     
    245245}
    246246
    247 static inline void CarryCombine(CarryQtype & cq, CarryQtype local_cq, int carryno, int carry_count) {
     247static inline void CarryCombine(CarryQtype & cq, CarryQtype local_cq, const int carryno, const int carry_count) {
    248248  cq = simd_or(cq, local_cq);
    249249}
    250250
    251 static inline void CarryQ_Adjust(CarryQtype & cq, int carry_count) {
     251static inline void CarryQ_Adjust(CarryQtype & cq, const int carry_count) {
    252252  // Adjust the carryQ so that carries enqueued are readied for dequeiing.
    253253  cq = sisd_srli(cq, (128-carry_count));
     
    413413
    414414
    415 static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, int carryno) {
     415static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, const int carryno) {
    416416        BitBlock rslt;
    417417        carryQ_advance_with_carry_ci_co(strm, cq, rslt);
     
    419419}
    420420
    421 static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, int carryno) {
     421static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, const int carryno) {
    422422        BitBlock rslt;
    423423        carryQ_advance_with_carry_co(strm, cq, rslt);
     
    425425}
    426426
    427 static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     427static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    428428        BitBlock sum;
    429429        carryQ_adc128_ci_co(strm1, strm2, cq, sum);
     
    431431}
    432432
    433 static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     433static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    434434        BitBlock sum;
    435435        carryQ_adc128_co(strm1, strm2, cq, sum);
     
    437437}
    438438
    439 static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     439static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    440440        BitBlock diff;
    441441        carryQ_sbb128_ci_co(strm1, strm2, cq, diff);
     
    443443}
    444444
    445 static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, int carryno) {
     445static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) {
    446446        BitBlock diff;
    447447        carryQ_sbb128_co(strm1, strm2, cq, diff);
     
    449449}
    450450
    451 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, int carryno) {
     451static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    452452        BitBlock markers1;
    453453        carryQ_adc128_ci_co(markers0, charclass, cq, markers1);
     
    455455}
    456456
    457 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, int carryno) {
     457static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    458458        BitBlock markers1;
    459459        carryQ_adc128_co(markers0, charclass, cq, markers1);
     
    461461}
    462462
    463 static inline bool CarryTest(CarryQtype cq, int carryno, int carry_count) {
     463static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) {
    464464//         print_general_register_64("cq", cq);
    465465        uint64_t carryQ_top_N_mask = ~(0xFFFFFFFFFFFFFFFFULL >> carry_count);
     
    467467}
    468468
    469 static inline void CarryDequeueEnqueue(CarryQtype & cq, int carryno, int carry_count) {
     469static inline void CarryDequeueEnqueue(CarryQtype & cq, const int carryno, const int carry_count) {
    470470        // Given carryin queue with carry_count carries starting from carryno are 0,
    471471        // ensure that the carryout queue has carry_count carries starting from carryno set to 0.
     
    473473}
    474474
    475 static inline void CarryCombine(CarryQtype & cq, CarryQtype local_cq, int carryno, int carry_count) {
     475static inline void CarryCombine(CarryQtype & cq, CarryQtype local_cq, const int carryno, const int carry_count) {
    476476        cq |= local_cq;
    477477}
Note: See TracChangeset for help on using the changeset viewer.