From 9928feca5fc1655a62e074cb3b6259fce55a3ac8 Mon Sep 17 00:00:00 2001 From: Andy Liu Date: Sat, 30 Nov 2024 20:24:14 +0700 Subject: [PATCH] Fix error in func getRGB565BE Signed-off-by: Andy Liu --- Examples/SwiftIOPlayground/08LCD/Rainbow/Sources/main.swift | 2 +- .../SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/SwiftIOPlayground/08LCD/Rainbow/Sources/main.swift b/Examples/SwiftIOPlayground/08LCD/Rainbow/Sources/main.swift index ece9323..8883dd5 100644 --- a/Examples/SwiftIOPlayground/08LCD/Rainbow/Sources/main.swift +++ b/Examples/SwiftIOPlayground/08LCD/Rainbow/Sources/main.swift @@ -47,5 +47,5 @@ while true { // The screen needs RGB565 color data, so change color data from UInt32 to UInt16. // Besides, the board uses little endian format, so the bytes are swapped. func getRGB565BE(_ color: UInt32) -> UInt16 { - return UInt16(((color & 0xF80000) >> 8) | ((color & 0xFC00) >> 5) | ((color & 0xF8) >> 3)).byteSwapped + return (UInt16((color & 0xF80000) >> 8) | UInt16((color & 0xFC00) >> 5) | UInt16((color & 0xF8) >> 3)).byteSwapped } \ No newline at end of file diff --git a/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift b/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift index e4aedca..b242000 100644 --- a/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift +++ b/Examples/SwiftIOPlayground/08LCD/ScrollEffect/Sources/main.swift @@ -48,5 +48,5 @@ while true { // The screen needs RGB565 color data, so change color data from UInt32 to UInt16. // Besides, the board uses little endian format, so the bytes are swapped. func getRGB565BE(_ color: UInt32) -> UInt16 { - return UInt16(((color & 0xF80000) >> 8) | ((color & 0xFC00) >> 5) | ((color & 0xF8) >> 3)).byteSwapped + return (UInt16((color & 0xF80000) >> 8) | UInt16((color & 0xFC00) >> 5) | UInt16((color & 0xF8) >> 3)).byteSwapped } \ No newline at end of file