refactor NGE_INC macro for improved robustness and operator precedence handling. The NGE_INC(x, y) macro was corrected to include additional parenthesis to ensure the proper order of operations. It now increments x by 1 and applies the modulo y correctly, ensuring consistent and error-free behavior, particularly in complex expressions

This commit is contained in:
purplerain 2023-09-30 05:22:07 +00:00
parent f857de4ffe
commit b13fe1161c
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7

View File

@ -528,7 +528,7 @@ struct nge_desc_32 {
#define NGE_LASTDESC(x) (!((x)->nge_ctl & NGE_CMDSTS_MORE))
#define NGE_OWNDESC(x) ((x)->nge_ctl & NGE_CMDSTS_OWN)
#define NGE_INC(x, y) (x) = (x + 1) % y
#define NGE_INC(x, y) ((x) = ((x) + 1) % (y))
#define NGE_RXBYTES(x) ((x)->nge_ctl & NGE_CMDSTS_BUFLEN)
#define NGE_RXSTAT_RANGELENERR 0x00010000