Ignore:
Timestamp:
Dec 31, 2012, 11:56:37 AM (7 years ago)
Author:
cameron
Message:

Fast bitpack implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/carryInfo.py

    r2699 r2802  
    114114    self.block_visit(whileNode)
    115115
     116
     117
     118
     119#
     120#
     121# Determine the number of carries directly within each block.
     122#
     123def direct_block_carries(carryInfoSet, count_advance_1_as_carry = True, count_advance_n_as_n = False):
     124    carries = [0 for i in range(carryInfoSet.block_count)]
     125    for op in range(carryInfoSet.operation_count):
     126        b = carryInfoSet.containing_block[op]
     127        if op not in carryInfoSet.advance_amount.keys():
     128          carries[b] += 1
     129        elif carryInfoSet.advance_amount[op] == 1 and count_advance_1_as_carry:
     130          carries[b] += 1
     131        elif count_advance_n_as_n:
     132          carries[b] += carryInfoSet.advance_amount[op]
     133    return carries
     134
     135
    116136#
    117137#####################################
Note: See TracChangeset for help on using the changeset viewer.