Skip to content

Dynamically choose underlying atomic unsigned size based on enum variants count #13

@tqwewe

Description

@tqwewe

This library uses AtomicUsize as the underlying numeric atomic size. In most cases, AtomicU8 would be possible, but it would be nice if the macro could change the underlying atomic type based on how many variants there are.

Of course, some embedded devices don't support atomic u8 or other types specifically, but this could be resolved by falling back to AtomicUsize using conditional compilation.

Eg:

#[cfg(target_has_atomic = "8")]
pub struct AtomicCatState(AtomicU8);

#[cfg(not(target_has_atomic = "8"))]
pub struct AtomicCatState(AtomicUsize);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions