Rust

Actual List of Rust Targets

Rust’s cross-compilation story is one of its biggest strengths. Whether you’re building for embedded devices, mobile platforms, game consoles, or cloud environments, Rust provides a wide range of targets that define how your code is compiled and what platform it runs on.

This post collects the actual list of targets available on my system, along with quick instructions on how to list, install, and remove toolchains using rustup.

Using ISPC for SIMD Acceleration on Windows

This note documents a practical experiment with ISPC on Windows: compiling a simple SIMD kernel, exporting it from a DLL, generating an import library, and calling it from Rust and LabVIEW. The goal is to compare ISPC’s generated AVX2 code with native Rust and LabVIEW implementations and to examine the generated assembly.

Finding the Remainder of \(9^{2018} \mod 7\) - Understanding Modular Patterns

When you first see an expression like

\[ 9^{2018} \mod 7, \]

it looks impossible to compute. The number \(9^{2018}\) is unimaginably large — far beyond what any calculator can display.

Fortunately, modular arithmetic has a wonderful property: even enormous powers often fall into small repeating cycles. Once you notice the pattern, the problem becomes surprisingly simple.

This post walks you through the reasoning step by step.

Understanding Miri and Stacked Borrows in Rust — Why One Example Is UB and the Other Isn’t

Rust’s borrow checker guarantees memory safety at compile time, but some rules—especially around raw pointers—are too subtle for the compiler alone. That’s where Miri comes in. In this post, we’ll walk through two tiny Rust programs: one that Miri accepts, and one that Miri flags as Undefined Behavior. The difference comes down to how Stacked Borrows tracks pointer permissions.

Measuring the True Cost of Div (32‑bit vs 64‑bit with Rust and Inline Asm)

Modern CPUs are fast—but some instructions still hide surprising costs. One of the most misunderstood is DIV. Is 32‑bit division faster than 64‑bit? Does instruction width matter anymore on x86‑64?

To answer this properly, we need more than wall‑clock timers. We need cycle counters, instruction retirement statistics, serialization barriers, and tight control over CPU affinity.

HIR MIR LIR (LLVM IR)

Time to time, and especially for learning purposes, it’s useful to inspect the internal representations that the Rust compiler generates. Below are some notes on how to do that.