WEBVTT

1
00:00:00.000 --> 00:00:08.467
This overview explains how ordered Boolean outputs
occupy bit positions in an integer or packed word.

2
00:00:08.467 --> 00:00:16.967
Confusing assignment order with printed binary order can make
a correct value appear reversed or put it in the wrong position.

3
00:00:17.276 --> 00:00:25.697
For this packing example, assign bit zero to input zero zero, bit one to zero one, bit two to one zero, and bit three to one one.

4
00:00:25.697 --> 00:00:28.173
We pack the output bits of or.

5
00:00:28.173 --> 00:00:32.789
The input labels identify positions; they are not the values being packed.

6
00:00:33.539 --> 00:00:36.480
Multiply each output by its bit weight.

7
00:00:36.480 --> 00:00:43.101
The zero contributes nothing, and the three ones contribute two, four, and eight, totaling fourteen.

8
00:00:43.101 --> 00:00:49.733
Written as a binary numeral, the highest bit appears on the left, so the word reads one one one zero.

9
00:00:49.733 --> 00:00:54.106
The displayed truth-vector order is still zero one one one.

10
00:00:54.406 --> 00:00:57.591
For input one zero, select position two.

11
00:00:57.591 --> 00:01:02.981
The four-bit numeral one one one zero shifts right twice to zero zero one one.

12
00:01:02.981 --> 00:01:08.673
A mask names the positions to keep: zero zero zero one keeps only the low bit.

13
00:01:08.673 --> 00:01:16.014
Pairwise and gives zero and zero, zero and zero, one and zero, and one and one: zero zero zero one.

14
00:01:16.014 --> 00:01:19.521
The retrieved answer is one.

15
00:01:19.821 --> 00:01:23.621
The retained example uses hexadecimal notation.

16
00:01:23.621 --> 00:01:30.552
The prefix zero x marks base sixteen, where the digit E means fourteen.

17
00:01:30.852 --> 00:01:35.128
Each hexadecimal digit represents four binary positions.

18
00:01:35.128 --> 00:01:42.620
One E E E therefore spells zero zero zero one, then three groups of one one one zero.

19
00:01:42.620 --> 00:01:48.414
It is a different spelling of the same number, not a new logical operator.

20
00:01:48.714 --> 00:01:52.909
That number is seven thousand nine hundred eighteen in decimal.

21
00:01:52.909 --> 00:01:59.899
Its meaning as a truth word still depends on the declared valid width and assignment-to-bit order.

22
00:01:59.899 --> 00:02:04.285
Assign each truth output a bit position.

23
00:02:04.285 --> 00:02:11.252
For this example, assignments A B C D run from 0000 to 1111;

24
00:02:11.252 --> 00:02:16.752
output for assignment index j occupies bit j.

25
00:02:16.752 --> 00:02:21.485
Written binary numerals normally print their most significant bit first,

26
00:02:21.485 --> 00:02:25.952
so do not confuse that print order with assignment order.

27
00:02:25.952 --> 00:02:33.018
First compute A AND B and C OR D, then
take the exclusive-or of those results.

28
00:02:33.018 --> 00:02:43.152
In ascending assignment order, the outputs are 0111 0111 0111 1000.

29
00:02:43.152 --> 00:02:49.185
Packing with bit j assigned to output j gives hexadecimal 0x1EEE.

30
00:02:49.185 --> 00:02:53.285
A word array can carry those same bits in lanes.

31
00:02:53.285 --> 00:03:02.785
For a toy six-bit result, bitwise NOT must be followed
by mask 111111 to discard unused high bits.

32
00:03:02.785 --> 00:03:07.685
Packing changes storage and execution layout, not the function.

33
00:03:07.685 --> 00:03:14.118
Current direct BitSet evaluation memoizes
expression identities and supports fixed bindings;

34
00:03:14.118 --> 00:03:20.018
calling it raw unshared AST would misdescribe this implementation.

35
00:03:20.018 --> 00:03:25.383
Big integers and machine words need separate
measurements before choosing an engine.

36
00:03:25.683 --> 00:03:29.808
Return to the four-bit word for F equals A or B.

37
00:03:29.808 --> 00:03:32.273
The numeric word is fourteen.

38
00:03:32.273 --> 00:03:41.483
Its valid width is four, with inputs zero zero, zero one, one zero and one one assigned to bit positions zero through three.

39
00:03:41.483 --> 00:03:45.744
Here A and B are both zero.

40
00:03:46.494 --> 00:03:50.236
The numeric word fourteen has its lowest bit clear.

41
00:03:50.236 --> 00:03:56.056
Because input zero zero was assigned to bit zero, masking that bit gives zero.

42
00:03:56.056 --> 00:04:01.934
Reading bit one instead would give one and would answer the neighboring input zero one.

43
00:04:01.934 --> 00:04:06.817
An off-by-one address can produce a plausible but incorrect answer.

44
00:04:07.567 --> 00:04:11.377
This case establishes a specific contrast.

45
00:04:11.377 --> 00:04:14.238
Bit position comes from the declared order.

46
00:04:14.238 --> 00:04:17.678
Packed values still require exact addressing.

47
00:04:17.678 --> 00:04:23.986
Keep the input, intermediate values, and conclusion together when comparing it with the previous case.

48
00:04:23.986 --> 00:04:30.104
The calculated answer belongs to this complete assignment under the stated rule.

49
00:04:30.104 --> 00:04:30.105
The calculated answer belongs to this complete assignment under the stated rule.

50
00:04:30.405 --> 00:04:34.039
The word stores four valid truth outputs.

51
00:04:34.039 --> 00:04:39.605
A machine integer may contain many more bit positions, so its full machine-word complement

52
00:04:39.605 --> 00:04:43.405
does not by itself identify the valid outputs.

53
00:04:43.405 --> 00:04:48.405
Keep the width and the valid-bit mask alongside the data.

54
00:04:48.405 --> 00:04:52.372
Complementing and then masking to four bits gives one.

55
00:04:52.372 --> 00:04:58.139
In assignment order, that is one zero zero zero, the outputs of not or.

56
00:04:58.139 --> 00:05:01.505
The mask removes unused high bits instead of counting them

57
00:05:01.505 --> 00:05:05.105
as extra satisfying assignments.

58
00:05:05.105 --> 00:05:08.805
With four Boolean inputs, there are sixteen assignments and therefore

59
00:05:08.805 --> 00:05:11.205
sixteen outputs to pack.

60
00:05:11.205 --> 00:05:16.172
There are not merely four output bits because there are four input variables.

61
00:05:16.172 --> 00:05:20.772
Packing can reduce storage overhead, but whether it improves a particular request depends

62
00:05:20.772 --> 00:05:25.426
on construction, operations, and output delivery.

63
00:05:25.426 --> 00:05:25.439
on construction, operations, and output delivery.

64
00:05:25.439 --> 00:05:30.239
Declare the assignment-to-bit mapping and requested width.

65
00:05:30.239 --> 00:05:36.424
Mask negation to that width and measure
engines under the same output contract.
