Skip to content

Instantly share code, notes, and snippets.

View Pikachuxxxx's full-sized avatar
🎩
lol

Phani Srikar Pikachuxxxx

🎩
lol
View GitHub Profile
@Pikachuxxxx
Pikachuxxxx / custom_move_semantics.cpp
Created November 2, 2025 06:40
How Razix handles it's own std:: move
namespace Razix {
// this remote_refence is to convert a Type value from either value/ref/&& to a &&, used for custom move semantics
// It removes & or && from a type so you can get the underlying base type
template <typename T> struct rz_remove_reference {using type = T;};
template <typename T> struct rz_remove_reference<T&> {using type = T;};
template <typename T> struct rz_remove_reference<T&&> {using type = T;};
// custom razix move semantics, get the underlying base type and force cast to r-value ref
template <typename T>
@Pikachuxxxx
Pikachuxxxx / barbie_girl_webserver.c
Last active November 1, 2025 15:52
love this song and wanted to write a small web server in C so yeah
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <arpa/inet.h>
#define PORT 8080
#define MAX_MESSAGES 128
#define MAX_MSG_LEN 2048
@Pikachuxxxx
Pikachuxxxx / approaches.txt
Created October 30, 2025 05:24
how to solve some problems, just my thoughts
1. How to convert a string to integer with SIMD acceleration (explained with NEON intrinsics)
// vld1q_u8 to load 16 chars
// create masks:
// is_digit (0-9) using vceq_u8
// is_plus --> vaddvq_u8 --> to get quick answer --> update global state
// is_minus --> vaddvq_u8 --> to get quick answer --> update global state
// is_space
// ignore_mask = vorrq_u8 --> combine masks (is_plus/minus/space)
// convert to digits --> subtrack '0', vsubq_u8/vdupq_u8
// apply digit mask and convert them to 0, vbslq_u8
@Pikachuxxxx
Pikachuxxxx / neon_instrinsics.c
Created October 29, 2025 06:21
just some basic ARM neon intrinsics practice
// neon_practice.c
// Practice file for learning ARM NEON intrinsics
// Compile with: clang -O3 neon_practice.c -o neon_practice
#include <arm_neon.h>
#include <stdio.h>
// ---------------------------------------------------------
// Exercise 1: Vector addition
// Task: Add two float32x4_t vectors element-wise
@Pikachuxxxx
Pikachuxxxx / f64toa.c
Last active October 29, 2025 06:21
IEEE754 double to string conversion function upto 3 precision bits for denormals
static uint64_t ftoa(double val, char* buf, uint32_t precision)
{
// double IEEE-745: [sign:1] [exponent:11] [mantissa:52]
// bias = 1023, all exponents have bias to store as positive numbers
// normalized => exponent != 0, subnormal => exponent == 0
uint64_t bytes = 0;
union { double d; uint64_t u; } v = { val };
uint64_t bits = v.u;
int64_t exponent = (bits >> 52) & (0x7FF); // remove 52 bits and get the trailing 11 bits
@Pikachuxxxx
Pikachuxxxx / disney_pbr.h
Created September 26, 2025 22:39
Disney BRDF PBR (clear coat, sheen etc.)
// Disney BRDF Parameter Structure
struct DisneyBRDFParams
{
float3 baseColor; // Base color (albedo)
float metallic; // Metallic parameter [0, 1]
float subsurface; // Subsurface scattering amount [0, 1]
float specular; // Specular amount [0, 1]
float roughness; // Surface roughness [0, 1]
float specularTint; // Specular tint toward base color [0, 1]
float anisotropic; // Anisotropy amount [0, 1]
@Pikachuxxxx
Pikachuxxxx / Arrays.hpp
Created September 22, 2025 16:30
Custom Arrays for Razix Engine
#pragma once
namespace Razix {
// Forward declarations
template<typename T, size_t N>
class FixedArray;
template<typename T>
class DynamicArray;
Set-PSReadlineOption -HistorySavePath "$env:USERPROFILE\Documents\PowerShell_history.txt"
Set-PSReadlineOption -MaximumHistoryCount 10000
Set-PSReadlineOption -HistoryNoDuplicates
Set-PSReadLineOption -PredictionSource History
oh-my-posh init pwsh --config https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/slim.omp.json | Invoke-Expression
@Pikachuxxxx
Pikachuxxxx / whyIloveCJumptablesAndMacros.c
Last active August 19, 2025 18:49
Razix RHI C macro magic for clean Jumptables based API and support C++ style with profiling
// Why I love C and Jumptables:
#define rzRHI_DestroyDescriptorHeap g_RHI.DestroyDescriptorHeap
#define rzRHI_CreateDescriptorTable g_RHI.CreateDescriptorTable
#define rzRHI_DestroyDescriptorTable g_RHI.DestroyDescriptorTable
#if !RZ_PROFILER_ENABLED
#if defined(RAZIX_RHI_USE_RESOURCE_MANAGER_HANDLES) && defined(__cplusplus)
#define rzRHI_BeginCmdBuf(cb) g_RHI.BeginCmdBuf(RZResourceManager::Get().getCommandBufferResource(cb))
@Pikachuxxxx
Pikachuxxxx / depth_clamp_api_test.lua
Last active August 19, 2025 18:51
Love2D new setDepthClamp API tests
local love = require("love")
-- Test case for setDepthClamp function
local TestDepthClamp = {}
function love.conf(t)
t.renderers = {"opengl"}
end
function TestDepthClamp:load()