<commit_before>/*
 * memalign related stuff
 */

#include <mach/vm_map.h>
#include <mach/mach_init.h>

static unsigned log2int(unsigned x) { return (x<2) ? 0 : log2int (x>>1)+1; };

static unsigned roundDownPowerOf2(unsigned x) { return (1 << log2int(x)); };
static unsigned roundUpPowerOf2(unsigned x)
{
    static unsigned one = 1;
    unsigned log2Int = log2int(x);
    
    return ((one << log2Int) == x) ? x : (one << (log2Int + 1));
};

static unsigned roundUpToPageBoundary(unsigned x)
{
    unsigned roundedDown = trunc_page(x);
    
    return (roundedDown == x) ? x : (roundedDown + vm_page_size);
};

typedef struct _memalign_marker_t {
                    vm_address_t start; 
                    vm_size_t size; } memalign_marker_t;

void *
Parrot_memalign(size_t align, size_t size)
{
    size_t effectiveAlign = align;
    size_t padding = 0;
    size_t amountToAllocate = 0;
    
    if( effectiveAlign < sizeof(void *) )<commit_msg>warning: ISO C does not allow extra ';' outside of a function<commit_after>/*
 * memalign related stuff
 */

#include <mach/vm_map.h>
#include <mach/mach_init.h>

static unsigned log2int(unsigned x) { return (x<2) ? 0 : log2int (x>>1)+1; }

static unsigned roundDownPowerOf2(unsigned x) { return (1 << log2int(x)); }
static unsigned roundUpPowerOf2(unsigned x)
{
    static unsigned one = 1;
    unsigned log2Int = log2int(x);
    
    return ((one << log2Int) == x) ? x : (one << (log2Int + 1));
}

static unsigned roundUpToPageBoundary(unsigned x)
{
    unsigned roundedDown = trunc_page(x);
    
    return (roundedDown == x) ? x : (roundedDown + vm_page_size);
}

typedef struct _memalign_marker_t {
                    vm_address_t start; 
                    vm_size_t size; } memalign_marker_t;

void *
Parrot_memalign(size_t align, size_t size)
{
    size_t effectiveAlign = align;
    size_t padding = 0;
    size_t amountToAllocate = 0;
    
    if( effectiveAlign < sizeof(void *) )
{'fraction_non_alphanumeric': 0.11946446961894953, 'fraction_numerical': 0.018537590113285273, 'mean_word_length': 3.2609649122807016, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3613617', 'n_tokens_mistral': 693, 'n_tokens_neox': 668, 'n_words': 172}