Skip to content

Integral Type Methods. #27

@shishioko

Description

@shishioko

The Suggestion is to allow some built, as well as extended ones, if this will be a language feature, Methods/Functions to be used directly on inline integer values.

This could be used to reduce code size overhead, at no additional cost.

The following is an example of the possible usage.

u64 networkSize = 256.InvertEndianness();

Alongside this, some commonly useful methods should be implemented, such as:

  • reversing the endianness
  • converting data to a specific endianness (changing the endianness to another, unless the target endianness is the system endianness)
  • calculating the ceiling (rounded up) number of a floating point number
  • calculating the floor (rounded down) number of a floating point number
  • calculating a commonly rounded floating point number (2.4 -> 2.0, 2.5 -> 2.0 2.6 -> 3.0)

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