Skip to content

Instantly share code, notes, and snippets.

View Clemapfel's full-sized avatar

Clem Cords Clemapfel

View GitHub Profile
@Clemapfel
Clemapfel / julia_swizzling_hello_world.jl
Last active September 11, 2022 18:29
Swizzling in Julia: Basic Mechanism
# Basic mechanism for how to implement GLSL-like swizzling in Julia
mutable struct Vec2
_private_00::Float32
_private_01::Float32
Vec2(x, y) = new(x, y)
end
function Base.getproperty(instance::Vec2, sym::Symbol)
#include <thread>
#include <chrono>
#include <jluna.hpp>
// references https://github.com/Clemapfel/jluna/issues/33
int main()
{
using namespace jluna;
initialize(2);
#include <jluna.hpp>
#include <.benchmark/benchmark.hpp>
#include <.benchmark/benchmark_aux.hpp>
#include <thread>
#include <future>
#include <queue>
using namespace jluna;
int main()
//
// Copyright 2022 Clemens Cords
// Created on 14.03.22 by clem (mail@clemens-cords.com)
//
#include <jluna.hpp>
using namespace jluna;
// this code are examples given as a response to https://github.com/Clemapfel/jluna/issues/12
@Clemapfel
Clemapfel / why.jl
Last active March 4, 2022 20:24
Find all k-sized subsets of arbitrary integer set such that xor is 0
function set_xor(set::Set{T}) where T
res = undef
front::Bool = true
for e in set
if front
res = e
front = false
else
res = Base.xor(res, e)