From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: video: fbdev: sm712: Fix operator precedence in big_swap macro Date: Sat, 16 May 2026 10:14:54 +1000 Message-ID: In-Reply-To: <20260515010202.2506-1-lirongqing@baidu.com> References: <20260515010202.2506-1-lirongqing@baidu.com> <20260515010202.2506-1-lirongqing@baidu.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Status: Correct fix for a real bug.** The commit message clearly explains the problem: C operator precedence mean= s `<<` and `>>` bind tighter than `&`, so the original code: ```c #define big_swap(p) ((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8)) ``` was parsed as: ```c ((p & (0xff00ff00 >> 8)) | (p & (0x00ff00ff << 8))) ``` which is `((p & 0x00ff00ff) | (p & 0xff00ff00))` =E2=80=94 effectively just= `p` (identity), completely defeating the byte swap. The fix: ```c #define big_swap(p) (((p & 0xff00ff00) >> 8) | ((p & 0x00ff00ff) << 8)) ``` correctly masks first, then shifts, implementing a proper swap of the high = and low bytes within each 16-bit half of a 32-bit value. **Verification:** All three call sites in `sm712fb.c` (lines 1010, 1069, 11= 41) use this for big-endian palette and framebuffer operations. The fix res= tores the intended byte-swap behavior that has been broken since the origin= al merge. **Nit (not blocking):** The macro argument `p` is not wrapped in parenthese= s (e.g., `(p)`) to guard against complex expressions. Since all current cal= lers pass simple lvalues, this is a pre-existing cosmetic issue and not wor= th blocking the fix. **Verdict: Reviewed-by worthy.** The Fixes tag correctly identifies the ori= ginating commit, and the fix is minimal and correct. --- Generated by Claude Code Patch Reviewer