Skip to content

dec: is from_raw_parts unsafe? #66

@benesch

Description

@benesch

#61 got me thinking: if Decimal::<N>::from_raw_parts is provided with a digits value that exceeds the maximum number of digits that can be stored in lsu for the specified N, does memory unsafety result? We should investigate!

If it does, I think we have two options:

  1. Mark from_raw_parts as unsafe and document the danger.
  2. Add a check (or checks?) like those that were added in dec: add to/from raw parts using BCD-encoded versions of LSU #61 and see what the performance impact is.

cc @sploiselle

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