Skip to content

Question, Aligned size calculation #3

@manuka89

Description

@manuka89

Hi there,

I'm found the following calculation in cacheline.h:

inline static size_t cacheLineAlignedSize(size_t sz) noexcept { return (CACHE_LINE_SIZE * ((sz + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE)) + CACHE_LINE_SIZE - 1; }

I'm a bit confused, could you please explain what is the need of this calculation? If my cacheline is 64 bytes and I have a structure of 64 bytes why do I need to reserve 127 bytes?

Thanks. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions