Skip to content

Commit

Permalink
memory-layout/memory-operations: Parenthesize GET_PIXEL macro
Browse files Browse the repository at this point in the history
This commit adds parentheses around function-like macro parameters. For
more details, see systems-cs-pub-ro/iocla#172.

Signed-off-by: Cosmin Popa <[email protected]>
  • Loading branch information
c7stef authored and teodutu committed Mar 19, 2024
1 parent e8c4795 commit 10fcfcf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ p.b = 0.11 * p.b;
> **Hint:** For simplicity, you can use the following macro:
>
> ```c
> #define GET_PIXEL(a, i ,j) (*(*(a + i) + j))
> #define GET_PIXEL(a, i ,j) (*(*((a) + (i)) + (j)))
> ```
If you're having difficulties solving this exercise, go through [this](../../../reading/README.md#structures-and-pointers-to-structures) reading material.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <time.h>
#include "pixel.h"

#define GET_PIXEL(a, i, j) (*(*(a + i) + j))
#define GET_PIXEL(a, i, j) (*(*((a) + (i)) + (j)))

void color_to_gray(struct picture *pic)
{
Expand Down

0 comments on commit 10fcfcf

Please sign in to comment.