-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bitfields not generating for all types
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <stdint.h> | ||
|
||
typedef struct { | ||
int one : 1; | ||
int two : 1; | ||
int three : 2; | ||
int four : 4; | ||
} bitmap; | ||
|
||
struct bitmap2 | ||
{ | ||
uint8_t frame_id : 1; | ||
uint8_t end_of_frame : 1; | ||
uint8_t presentation_time : 1; | ||
uint8_t source_clock : 1; | ||
uint8_t reserved : 1; | ||
uint8_t still_image : 1; | ||
uint8_t error : 1; | ||
uint8_t end_of_header : 1; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import "../src/futhark" | ||
|
||
importc: | ||
path "." | ||
"tbitfields.h" | ||
|
||
{.emit: "#include \"tbitfields.h\"".} | ||
proc getCsizeofBitmap(): cint = | ||
{.emit: [result, " = sizeof(bitmap);"].} | ||
|
||
proc getCsizeofHeaderInfoBitmap(): cint = | ||
{.emit: [result, " = sizeof(struct bitmap2);"].} | ||
|
||
echo getCsizeofBitmap() | ||
echo sizeof(bitmap) | ||
doAssert sizeof(bitmap) == getCsizeofBitmap() | ||
echo getCsizeofHeaderInfoBitmap() | ||
echo sizeof(structBitmap2) | ||
doAssert sizeof(structBitmap2) == getCsizeofHeaderInfoBitmap() |