Skip to content
View phecdaDia's full-sized avatar
πŸ³οΈβ€πŸŒˆ
πŸ³οΈβ€πŸŒˆ

Highlights

  • Pro
Block or Report

Block or report phecdaDia

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
phecdaDia/README.md

Hi there πŸ‘‹

  • πŸ“« How to reach me: Send me a quick github message or reach me by mail. πŸ˜‰
  • πŸ˜„ Pronouns: she/her
  • ⚑ Fun fact: Did you know that you can calculate the modulo of two numbers $n$ and $d$ by doing modulo reductions by $b$, which you can simply set to a power of two. This allows you to calculate modulo with only bitshifting, additions and a multiplication. Anyways, here is an example:
fn fmod(n: u32, d: u32) -> u32 
{
	// Check if n is less than d first
	if n < d { return n; }
	
	// Find a suitable p for our base
	for p in 2..32 {
		if 1 << p > n { 
            // Will always find a p.
			return fmod_p(n, d, p)
		}
	}
	unreachable!(); // Mark as unreachable
}

fn fmod_p(n: u32, d: u32, p: u32) -> u32
{
	if n < 1 << p {
		if n < d { return n; }
		if n < d << 1 { return n - d; }
		return fmod_p(n, d, p-1);
	}
	
	fmod_p(
		((1 << p) - d) * (n >> p) + (n & ((1 << p) - 1)),
		d,
		p
	)
} 

fn main() {
	// Simple fizzbuzz example
	for i in 1..101 {
		let mut s = String::new();
		if fmod(i, 3) == 0 { s.push_str("Fizz"); }
		if fmod(i, 5) == 0 { s.push_str("Buzz"); }
		if s.is_empty() { s.push_str(&i.to_string()); }
		println!("{}", s);
	}
}

Pinned

  1. ACNH ACNH Public

    Animal Crossing New Horizons stuff

    Python 65 14

  2. Changing image on click in discord. Changing image on click in discord.
    1
    import matplotlib.pyplot as plt
    2
    
                  
    3
    # don't fucking ask me how this works
    4
    magic_header = """
    5
    00 00 00 04 67 41 4D 41 00 00 27 10 4C 57 C2 4C 
  3. NTRSharp NTRSharp Public archive

    Library for C# Applications that use NTR made by cell9

    C# 10 2

  4. PyNTR PyNTR Public archive

    PyNTR

    Python 8 2

  5. NTRClient NTRClient Public archive

    Forked from Hartie95/NTRClient

    the NTR Debugger. [deprecated] Goto https://github.com/imthe666st/NTRSharp for the new project.

    C# 21 3