summaryrefslogtreecommitdiff
path: root/malloc/page_begin/main.c
blob: 8fc931eb22f9c2c82c70879bca39faf5ba982db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

#include "page_begin.h"

static void display_result(void *ptr, size_t page_size, void *expected_result)
{
    void *res = page_begin(ptr, page_size);

    printf("ptr: %p\n", ptr);
    printf("page_size: %lu\n", page_size);
    printf("expected_result: %p\n", expected_result);
    printf("result: %p\n", res);

    printf(expected_result == res ? "OK\n" : "KO\n");
}

int main(void)
{
    display_result((void *)0x1234ffea, 4096, (void *)0x1234f000);
    display_result((void *)0x1234ffea, 256, (void *)0x1234ff00);
}