@@ -1056,8 +1056,12 @@ def bit_select(self, offset, width):
1056
1056
"""Part-select with bit granularity.
1057
1057
1058
1058
Selects a constant width, variable offset part of :pc:`self`, where parts with successive
1059
- offsets overlap by :pc:`width - 1` bits. When :pc:`offset` is a constant integer, this
1060
- operation is equivalent to :pc:`self[offset:offset + width]`.
1059
+ offsets overlap by :pc:`width - 1` bits. Bits above the most significant bit of :pc:`self`
1060
+ may be selected; they are equal to zero if :pc:`self` is unsigned, to :pc:`self[-1]` if
1061
+ :pc:`self` is signed, and assigning to them does nothing.
1062
+
1063
+ When :pc:`offset` is a constant integer and :pc:`offset + width <= len(self)`,
1064
+ this operation is equivalent to :pc:`self[offset:offset + width]`.
1061
1065
1062
1066
Parameters
1063
1067
----------
@@ -1086,8 +1090,12 @@ def word_select(self, offset, width):
1086
1090
"""Part-select with word granularity.
1087
1091
1088
1092
Selects a constant width, variable offset part of :pc:`self`, where parts with successive
1089
- offsets are adjacent but do not overlap. When :pc:`offset` is a constant integer, this
1090
- operation is equivalent to :pc:`self[offset * width:(offset + 1) * width]`.
1093
+ offsets are adjacent but do not overlap. Bits above the most significant bit of :pc:`self`
1094
+ may be selected; they are equal to zero if :pc:`self` is unsigned, to :pc:`self[-1]` if
1095
+ :pc:`self` is signed, and assigning to them does nothing.
1096
+
1097
+ When :pc:`offset` is a constant integer and :pc:`width:(offset + 1) * width <= len(self)`,
1098
+ this operation is equivalent to :pc:`self[offset * width:(offset + 1) * width]`.
1091
1099
1092
1100
Parameters
1093
1101
----------
0 commit comments