You are given a ConfigRegister struct that simulates a 16-bit configuration register.
Each bit in the register has a specific meaning:
| Bit Position | Meaning |
| 0 | Enable (1 = ON) |
| 1 | Mode (0 = Normal, 1 = Safe) |
| 2–3 | Priority (00 = Low, 01 = Medium, 10 = High, 11 = Invalid) |
| 4–15 | Reserved (must be 0) |
Your task is to validate the register:
- Return 1 if:
- Bit 0 is set (Enable ON)
- Bits 2–3 contain a valid priority (not 11)
- All bits 4–15 are 0
- Return 0 otherwise
Use pointer logic (-> or (*ptr).field) to access the data.
Example-1
Input: reg = 0x0005 (binary: 0000000000000101)
Output: 1
(Enable = 1, Mode = 0, Priority = 01 → Valid)
Example-2
Input: reg = 0x000B (binary: 0000000000001011)
Output: 1
Example-3
Input: reg = 0x0015 (binary: 0000000000010101)
Output: 0
(Bit 4 is set → Reserved violation)