Changed the size_t's in cpu/808x/queue.c/h into uintptr_t's and made the fatal() use PRIuPTR.
This commit is contained in:
@@ -42,12 +42,14 @@
|
|||||||
/* TODO: Move to cpu.h so this can eventually be reused for 286+ as well. */
|
/* TODO: Move to cpu.h so this can eventually be reused for 286+ as well. */
|
||||||
#define QUEUE_MAX 6
|
#define QUEUE_MAX 6
|
||||||
|
|
||||||
|
/* NOTE: When porting from Rust to C, please use uintptr_t and not size_t,
|
||||||
|
so it can be printed with PRIuPTR. */
|
||||||
typedef struct queue_t
|
typedef struct queue_t
|
||||||
{
|
{
|
||||||
size_t size;
|
uintptr_t size;
|
||||||
size_t len;
|
uintptr_t len;
|
||||||
size_t back;
|
uintptr_t back;
|
||||||
size_t front;
|
uintptr_t front;
|
||||||
uint8_t q[QUEUE_MAX];
|
uint8_t q[QUEUE_MAX];
|
||||||
uint16_t preload;
|
uint16_t preload;
|
||||||
queue_delay_t delay;
|
queue_delay_t delay;
|
||||||
@@ -74,19 +76,15 @@ queue_log(const char *fmt, ...)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
queue_set_size(size_t size)
|
queue_set_size(uintptr_t size)
|
||||||
{
|
{
|
||||||
if (size > QUEUE_MAX)
|
if (size > QUEUE_MAX)
|
||||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
fatal("Requested prefetch queue of %" PRIuPTR " bytes is too big\n", size);
|
||||||
fatal("Requested prefetch queue of %zu bytes is too big\n", size);
|
|
||||||
#else
|
|
||||||
fatal("Requested prefetch queue of %i bytes is too big\n", size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
queue.size = size;
|
queue.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
uintptr_t
|
||||||
queue_get_len(void)
|
queue_get_len(void)
|
||||||
{
|
{
|
||||||
return queue.len;
|
return queue.len;
|
||||||
|
@@ -26,8 +26,8 @@ typedef enum queue_delay_t
|
|||||||
|
|
||||||
#define FLAG_PRELOADED 0x8000
|
#define FLAG_PRELOADED 0x8000
|
||||||
|
|
||||||
extern void queue_set_size(size_t size);
|
extern void queue_set_size(uintptr_t size);
|
||||||
extern size_t queue_get_len(void);
|
extern uintptr_t queue_get_len(void);
|
||||||
extern int queue_is_full(void);
|
extern int queue_is_full(void);
|
||||||
extern uint16_t queue_get_preload(void);
|
extern uint16_t queue_get_preload(void);
|
||||||
extern int queue_has_preload(void);
|
extern int queue_has_preload(void);
|
||||||
|
Reference in New Issue
Block a user