<AlexandrosLiarok>
is anyone aware of any convenient method to generate const lookup tables using rust math expressions ?
<AlexandrosLiarok>
* expressions ? Either a const-fn math library or a procedural macro one maybe.
<AlexandrosLiarok>
* is anyone aware of any convenient method to generate const tables using rust math expressions ? Either a const-fn math library or a procedural macro one maybe.
<AlexandrosLiarok>
I guess main problem is I need to use f32 const-fn logs/exps
<AlexandrosLiarok>
I can do this with build-script generated tables but I don't think it is ideal.
<AndoThorNando[m]>
There’s an issue with const fn for floating point as the compiler evaluating the function may be on a different architecture with a conflicting floating point implementation to the target architecture causing potential for unsound code
<thejpster[m]>
> This is fully equivalent to addr as *const T. The provenance of the returned pointer is that of some pointer that was previously exposed by passing it to expose_provenance, or a ptr as usize cast. In addition, memory which is outside the control of the Rust abstract machine (MMIO registers, for example) is always considered to be accessible with an exposed provenance, so long as this memory is disjoint from memory that will be
<thejpster[m]>
used by the abstract machine such as the stack, heap, and statics.
<JamesMunns[m]>
Oh I didn't realize that was stabilizing!
<danielb[m]>
> The provenance of the returned pointer is that of some pointer that was previously exposed
<danielb[m]>
You still have to start with a pointer 🥲
<JamesMunns[m]>
whatcha mean?
<danielb[m]>
I mean this still doesn't handle the "we conjure up a register block at a particular address" case I asked about yesterday
<danielb[m]>
the Exposed Provenance chapter contains this:
<danielb[m]>
> Bare-metal platforms can also require the synthesis of a pointer “out of thin air” without anywhere to obtain proper provenance from.
<danielb[m]>
so the current api still doesn't cover all the author wants, it seems?
<JamesMunns[m]>
it doesn't? the second part of what JP quoted seems to cover that?
<JamesMunns[m]>
> In addition, memory which is outside the control of the Rust abstract machine (MMIO registers, for example) is always considered to be accessible with an exposed provenance, so long as this memory is disjoint from memory that will be used by the abstract machine such as the stack, heap, and statics.
<JamesMunns[m]>
which means you can use yolo ints as long as the addrs are outside of the AM?
<danielb[m]>
ah okay I didn't read far enough :D
<JamesMunns[m]>
like you can't use that for a static addr, but you can use it for a hw addr outside of the linker script basically
<JamesMunns[m]>
I wonder why it isn't a const fn 🤔
<thejpster[m]>
You should ask :)
<thejpster[m]>
(Like it EDWG doesn’t know, the rest of us don’t stand a chance)