chatchai_j icon

Untitled

chatchai_j | PRO | 07/29/14 01:43:53 AM UTC | 0 ⭐ | 502 👁️ | Never ⏰ | []
C |

530 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
 
#define PAGE_SIZE sizeof(uint64_t) * 8
#define PAGE_SIZE2 (sizeof(uint64_t) * 8)
 
int main(void) {
    uint16_t slot_id = 6005;
    uint16_t page = slot_id/PAGE_SIZE;
    uint16_t page2 = slot_id/PAGE_SIZE2;
 
    printf("PAGE_SIZE = %d\n", PAGE_SIZE);
    printf("slot_id = %d\n", slot_id);
    printf("page = %d\n", page);
    printf("page2 = %d\n", page2);
 
    printf("value = %d\n", 6005/8*8);
    printf("value2 = %d\n", 6005/(8*8));
 
    return 0;
}

Comments