#ifndef prototype1_src_l1_core_uint_segments_h
#define prototype1_src_l1_core_uint_segments_h

#include "int_primitives.h"

typedef struct {
    U64 start;
    U64 len;
} U64Segment;

typedef struct{
    U32 start;
    U32 len;
} U32Segment;

U64 U64Segment_get_length_resp_alignment(U64Segment self, U8 alignment_exp) {
    if (self.start & ((1ull << alignment_exp) - 1)) {
        U64 pad_left = (1ull << alignment_exp) - (self.start & ((1ull << alignment_exp) - 1));
        return self.len >= pad_left ? self.len - pad_left : 0;
    }
    return self.len;
}

#endif
