@@ -382,9 +382,9 @@ extension UInt64 {
382
382
383
383
/// Extends `UInt8` providing initialization from a Unicode scalar.
384
384
extension UInt8 {
385
- /// Converts a UInt8 value into a UnicodeScalar
385
+ /// Converts a UInt8 ASCII value into a UnicodeScalar
386
386
@_transparent @_alwaysEmitIntoClient
387
- var ascii : Unicode . Scalar ? {
387
+ var asciiScalar : Unicode . Scalar ? {
388
388
guard self < 0x80 else { return nil }
389
389
return Unicode . Scalar ( self )
390
390
}
@@ -409,31 +409,19 @@ extension UInt8 {
409
409
/// - Returns: `true` when the `UInt8` is equal to the provided Unicode scalar; otherwise, `false`.
410
410
@_transparent @_alwaysEmitIntoClient
411
411
public static func == ( i: Self , s: Unicode . Scalar ) -> Bool {
412
- #if DEBUG
413
- return i == UInt8 ( ascii: s)
414
- #else
415
412
return i == UInt8 ( ifASCII: s)
416
- #endif
417
413
}
418
414
419
415
/// Returns a Boolean indicating whether the `UInt8` is not equal to the provided Unicode scalar.
420
416
@_transparent @_alwaysEmitIntoClient
421
417
public static func != ( i: Self , s: Unicode . Scalar ) -> Bool {
422
- #if DEBUG
423
- return i != UInt8 ( ascii: s)
424
- #else
425
418
return i != UInt8 ( ifASCII: s)
426
- #endif
427
419
}
428
420
429
421
/// Enables pattern matching of Unicode scalars in switch statements.
430
422
@_transparent @_alwaysEmitIntoClient
431
423
public static func ~= ( s: Unicode . Scalar , i: Self ) -> Bool {
432
- #if DEBUG
433
- return i == UInt8 ( ascii: s)
434
- #else
435
424
return i == UInt8 ( ifASCII: s)
436
- #endif
437
425
}
438
426
}
439
427
@@ -447,31 +435,19 @@ extension UInt8? {
447
435
/// - Returns: `true` if the optional `UInt8` is equal to the provided Unicode scalar; otherwise, `false`.
448
436
@_transparent @_alwaysEmitIntoClient
449
437
public static func == ( i: Self , s: Unicode . Scalar ) -> Bool {
450
- #if DEBUG
451
- return i == UInt8 ( ascii: s)
452
- #else
453
438
return i == UInt8 ( ifASCII: s)
454
- #endif
455
439
}
456
440
457
441
/// Returns a Boolean value indicating whether the optional `UInt8` is not equal to the provided Unicode scalar.
458
442
@_transparent @_alwaysEmitIntoClient
459
443
public static func != ( i: Self , s: Unicode . Scalar ) -> Bool {
460
- #if DEBUG
461
- return i != UInt8 ( ascii: s)
462
- #else
463
444
return i != UInt8 ( ifASCII: s)
464
- #endif
465
445
}
466
446
467
447
/// Allows pattern matching of Unicode scalars in switch statements.
468
448
@_transparent @_alwaysEmitIntoClient
469
449
public static func ~= ( s: Unicode . Scalar , i: Self ) -> Bool {
470
- #if DEBUG
471
- return i == UInt8 ( ascii: s)
472
- #else
473
450
return i == UInt8 ( ifASCII: s)
474
- #endif
475
451
}
476
452
}
477
453
0 commit comments