Skip to content

Commit

Permalink
alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Clark Gaebel committed Oct 28, 2017
1 parent 58d2ec1 commit 756f500
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 2048.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#define u8 uint8_t
#define u32 uint32_t

#define align(n) __attribute__((aligned(n)))

#define FOR(i, s, n) \
for(i8 i = s; i < n; ++i)

Expand All @@ -30,7 +32,7 @@
// If a tile at (i, j) is present, tiles[i][j] contains its log_2 value.
// If a tile at (i, j) is not present, tiles[i][j] = 0.
struct board {
u8 tiles[TILES_PER_DIM][TILES_PER_DIM];
u8 tiles[TILES_PER_DIM][TILES_PER_DIM] align(16);
};

struct game {
Expand Down Expand Up @@ -132,7 +134,7 @@ static void rotate_cw(struct board* b) {
*b = r;
}

static void move_nonzero_first(u8 row[]) {
static void move_nonzero_first(u8 row[TILES_PER_DIM]) {
i8 start_of_zeros = 0;
FOR(i, 0, TILES_PER_DIM) {
if(row[i] == 0) continue;
Expand Down

1 comment on commit 756f500

@est31
Copy link

@est31 est31 commented on 756f500 Oct 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @cgaebel ! I've been trying to contact you. I'm currently attempting to get the Rust language RFCs repo licensed under proper licensing terms. As you are a contributor, so I'd like to ask you to sign off here: rust-lang/rfcs#2076 Thank you!

Please sign in to comment.