Skip to content

Commit 135002e

Browse files
committed
svc: Remove extra casts from UVISOR_SVC_OPCODE
We don't need the uint8_t cast. Performing a bitwise and with 0xFF is good enough to force the range of values `id` can become. Remove the uint8_t cast. Keep the uint16_t cast, as the opcode should be seen as a uint16_t.
1 parent 04458eb commit 135002e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/system/inc/svc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
#define UVISOR_SVC_ID_UNVIC_IN UVISOR_SVC_FIXED_TABLE(0, 0)
100100

101101
/** Generate the SVCall opcode from the SVC ID. */
102-
#define UVISOR_SVC_OPCODE(id) ((uint16_t) 0xDF00 | (uint8_t) ((id) & 0xFF))
102+
#define UVISOR_SVC_OPCODE(id) ((uint16_t) (0xDF00 | ((id) & 0xFF)))
103103

104104
#define UVISOR_SVC_ID_GET(target) UVISOR_SVC_CUSTOM_TABLE(offsetof(UvisorSvcTarget, target) / sizeof(uint32_t))
105105

0 commit comments

Comments
 (0)