| OCR Text |
Show Each Boolean operation occupies five bits that specify dx, dy, Fx, Fy, and Fxy, not counting the result. Algorithm The implementation of the algorithm to evaluate Boolean expressions, procedure Boolean.Evaluation, is shown in Figure 4.17. Two main procedures, initialize and evaluate, perform initialization stage and evaluation stage computations described in the previous section. Procedure initialize initializes all three heaps, df, fp, and fxy. The results of Boolean expressions with all their independent inputs being set to 0 represent 32 initial values. They are put in 32 bits of element df [1]. The value of this element is stored in variable td. After the initialization stage, the expressions are evaluated for each new set of inputs. The procedure newinput sets all 32 bits of elements df [N] to df [2*N-1] to the new values of inputs. The core of the algorithm is procedure evaluate which stores the results in 32 bits of element df [1]. Because results represent differences from initial values, an Exclusive-OR operation is performed on the corresponding 32 bits in td and the corresponding 32 bits in df [1]. These final results are stored in 32 bits of the variable result. Each bit in the variable result is a result of one Boolean 105 Boolean_Evaluation() { int td, result; initialize(df,fp,fxy); /* initialization stage */ td = df [1]; /* get initial value */ while ("not end of input") { newinput(df); /* get input */ evaluate(df,fp,fxy); /* evaluation stage */ result = td * df [1]; /* get final results */ } } Figure 4.17. The Overview of the Algorithm |