You are given a 32-bit integer.
You must:
Only use union-based access. Do not use bitwise operations or shifts.
Example-1
Input: value = 305419896 (0x12345678) new_b1 = 0xAA, new_b2 = 0xBB Output: 314288760
(0x12BBAA78 → bytes = [0x78, 0xAA, 0xBB, 0x12])
Example-2
Input: value = 1 new_b1 = 255, new_b2 = 255 Output: 16776961
(0x00FFFF01)
Example-3
Input: value = 0 new_b1 = 1, new_b2 = 2 Output: 131328
(0x00020100)
Test Cases
Test Results
Input
305419896 170 187
Expected Output
314288760