@@ -12,6 +12,7 @@ import cllvm
1212/// supports both the typical integer arithmetic and comparison operations as
1313/// well as bitwise manipulation.
1414public struct APInt : IRConstant {
15+ /// The underlying word size.
1516 public typealias Word = UInt64
1617
1718 private enum Impl {
@@ -20,6 +21,8 @@ public struct APInt: IRConstant {
2021 }
2122
2223 private var value : Impl
24+
25+ /// The bitwidth of this integer.
2326 public private( set) var bitWidth : Int
2427
2528 fileprivate init ( raw values: [ Word ] , _ bits: Int ) {
@@ -166,12 +169,16 @@ extension APInt: Numeric {
166169 self . init ( integerLiteral: val)
167170 }
168171
172+ /// Returns the result of performing a bitwise AND operation on the two
173+ /// given values.
169174 public static func & ( lhs: APInt , rhs: APInt ) -> APInt {
170175 var lhs = lhs
171176 lhs &= rhs
172177 return lhs
173178 }
174179
180+ /// Stores the result of performing a bitwise AND operation on the two given
181+ /// values in the left-hand-side variable.
175182 public static func &= ( lhs: inout APInt , rhs: APInt ) {
176183 precondition ( lhs. bitWidth == rhs. bitWidth)
177184 switch ( lhs. value, rhs. value) {
@@ -188,12 +195,16 @@ extension APInt: Numeric {
188195 }
189196 }
190197
198+ /// Returns the result of performing a bitwise OR operation on the two
199+ /// given values.
191200 public static func | ( lhs: APInt , rhs: APInt ) -> APInt {
192201 var lhs = lhs
193202 lhs |= rhs
194203 return lhs
195204 }
196205
206+ /// Stores the result of performing a bitwise OR operation on the two given
207+ /// values in the left-hand-side variable.
197208 public static func |= ( lhs: inout APInt , rhs: APInt ) {
198209 precondition ( lhs. bitWidth == rhs. bitWidth)
199210 switch ( lhs. value, rhs. value) {
@@ -210,12 +221,16 @@ extension APInt: Numeric {
210221 }
211222 }
212223
224+ /// Returns the result of performing a bitwise XOR operation on the two
225+ /// given values.
213226 public static func ^ ( lhs: APInt , rhs: APInt ) -> APInt {
214227 var lhs = lhs
215228 lhs ^= rhs
216229 return lhs
217230 }
218231
232+ /// Stores the result of performing a bitwise XOR operation on the two given
233+ /// values in the left-hand-side variable.
219234 public static func ^= ( lhs: inout APInt , rhs: APInt ) {
220235 precondition ( lhs. bitWidth == rhs. bitWidth)
221236 switch ( lhs. value, rhs. value) {
@@ -388,12 +403,16 @@ extension APInt: Numeric {
388403 }
389404 }
390405
406+ /// Returns the result of shifting a value’s binary representation the
407+ /// specified number of digits to the left.
391408 public static func << ( lhs: APInt , amount: UInt64 ) -> APInt {
392409 var lhs = lhs
393410 lhs <<= amount
394411 return lhs
395412 }
396413
414+ /// Stores the result of shifting a value’s binary representation the
415+ /// specified number of digits to the left in the left-hand-side variable.
397416 public static func <<= ( lhs: inout APInt , amount: UInt64 ) {
398417 precondition ( amount <= lhs. bitWidth)
399418 switch lhs. value {
0 commit comments