Changeset 3676 for proto


Ignore:
Timestamp:
Mar 13, 2014, 3:16:02 AM (5 years ago)
Author:
ksherdy
Message:

Renamed Basis to Basis_bits.

Location:
proto/s2k/demo/needle
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/s2k/demo/needle/needle.py

    r3675 r3676  
    7979# Stream Structure definitions
    8080
    81 class Basis():
    82         b0 = 0
    83         b1 = 0
    84         b2 = 0
    85         b3 = 0
    86         b4 = 0
    87         b5 = 0
    88         b6 = 0
    89         b7 = 0
     81class Basis_bits():
     82        bit_0 = 0
     83        bit_1 = 0
     84        bit_2 = 0
     85        bit_3 = 0
     86        bit_4 = 0
     87        bit_5 = 0
     88        bit_6 = 0
     89        bit_7 = 0
    9090
    9191# Lexical items
     
    104104
    105105# Computes characters classes [n],[e],[d],[l] to mark `n',`e',`d',`l'
    106 def ClassifyBytes(basis, lex): 
    107         temp1 = (basis.b1 &~ basis.b0)
    108         temp2 = (basis.b2 &~ basis.b3)
     106def ClassifyBytes(basis_bits, lex):
     107        temp1 = (basis_bits.bit_1 &~ basis_bits.bit_0)
     108        temp2 = (basis_bits.bit_2 &~ basis_bits.bit_3)
    109109        temp3 = (temp1 & temp2)
    110         temp4 = (basis.b4 & basis.b5)
    111         temp5 = (basis.b6 &~ basis.b7)
     110        temp4 = (basis_bits.bit_4 & basis_bits.bit_5)
     111        temp5 = (basis_bits.bit_6 &~ basis_bits.bit_7)
    112112        temp6 = (temp4 & temp5)
    113113        lex.n = (temp3 & temp6)
    114         temp7 = (basis.b5 &~ basis.b4)
    115         temp8 = (basis.b7 &~ basis.b6)
     114        temp7 = (basis_bits.bit_5 &~ basis_bits.bit_4)
     115        temp8 = (basis_bits.bit_7 &~ basis_bits.bit_6)
    116116        temp9 = (temp7 & temp8)
    117117        lex.e = (temp3 & temp9)
    118         temp10 = (basis.b6 | basis.b7)
     118        temp10 = (basis_bits.bit_6 | basis_bits.bit_7)
    119119        temp11 = (temp7 &~ temp10)
    120120        lex.d = (temp3 & temp11)
     
    169169# byte-space methods.
    170170#
    171 def Main(basis, lex, matches):
    172         Transpose(byte_data, basis)
    173         ClassifyBytes(basis, lex)
     171def Main(basis_bits, lex, matches):
     172        Transpose(byte_data, basis_bits)
     173        ClassifyBytes(basis_bits, lex)
    174174        Match(lex, matches)
    175175
  • proto/s2k/demo/needle/needle_template.cpp

    r3675 r3676  
    9292/*
    9393struct Basis {
    94   BitBlock b7;
    95   BitBlock b6;
    96   BitBlock b5;
    97   BitBlock b4;
    98   BitBlock b3;
    99   BitBlock b2;
    100   BitBlock b1;
    101   BitBlock b0;
     94  BitBlock bit_7;
     95  BitBlock bit_6;
     96  BitBlock bit_5;
     97  BitBlock bit_4;
     98  BitBlock bit_3;
     99  BitBlock bit_2;
     100  BitBlock bit_1;
     101  BitBlock bit_0;
    102102};
    103103*/
     
    117117struct Transpose {
    118118       
    119   void do_block(char * byte_data, Basis & basis) {
     119  void do_block(char * byte_data, Basis_bits & basis_bits) {
    120120        BytePack * Byte = (BytePack *) byte_data;
    121121
    122122        s2p(Byte[0], Byte[1], Byte[2], Byte[3],
    123123            Byte[4], Byte[5], Byte[6], Byte[7],
    124             basis.b0, basis.b1, basis.b2, basis.b3,
    125             basis.b4, basis.b5, basis.b6, basis.b7);
     124            basis_bits.bit_0, basis_bits.bit_1, basis_bits.bit_2, basis_bits.bit_3,
     125            basis_bits.bit_4, basis_bits.bit_5, basis_bits.bit_6, basis_bits.bit_7);
    126126  } 
    127127
    128   void do_final_block(char * byte_data, Basis & basis, BitBlock & EOF_mask) {
     128  void do_final_block(char * byte_data, Basis_bits & basis_bits, BitBlock & EOF_mask) {
    129129        BytePack * Byte = (BytePack *) byte_data;
    130130
    131131        s2p(Byte[0], Byte[1], Byte[2], Byte[3],
    132132            Byte[4], Byte[5], Byte[6], Byte[7],
    133             basis.b0, basis.b1, basis.b2, basis.b3,
    134             basis.b4, basis.b5, basis.b6, basis.b7);
    135 
    136         basis.b7 = simd_and(basis.b7, EOF_mask);
    137         basis.b6 = simd_and(basis.b6, EOF_mask);
    138         basis.b5 = simd_and(basis.b5, EOF_mask);
    139         basis.b4 = simd_and(basis.b4, EOF_mask);
    140         basis.b3 = simd_and(basis.b3, EOF_mask);
    141         basis.b2 = simd_and(basis.b2, EOF_mask);
    142         basis.b1 = simd_and(basis.b1, EOF_mask);
    143         basis.b0 = simd_and(basis.b0, EOF_mask);
     133            basis_bits.bit_0, basis_bits.bit_1, basis_bits.bit_2, basis_bits.bit_3,
     134            basis_bits.bit_4, basis_bits.bit_5, basis_bits.bit_6, basis_bits.bit_7);
     135
     136        basis_bits.bit_7 = simd_and(basis_bits.bit_7, EOF_mask);
     137        basis_bits.bit_6 = simd_and(basis_bits.bit_6, EOF_mask);
     138        basis_bits.bit_5 = simd_and(basis_bits.bit_5, EOF_mask);
     139        basis_bits.bit_4 = simd_and(basis_bits.bit_4, EOF_mask);
     140        basis_bits.bit_3 = simd_and(basis_bits.bit_3, EOF_mask);
     141        basis_bits.bit_2 = simd_and(basis_bits.bit_2, EOF_mask);
     142        basis_bits.bit_1 = simd_and(basis_bits.bit_1, EOF_mask);
     143        basis_bits.bit_0 = simd_and(basis_bits.bit_0, EOF_mask);
    144144  }
    145145};
Note: See TracChangeset for help on using the changeset viewer.