Skip to content

Instantly share code, notes, and snippets.

View thecoolwinter's full-sized avatar

Khan Winter thecoolwinter

View GitHub Profile
@thecoolwinter
thecoolwinter / intpow.swift
Last active May 1, 2025 20:47
A fast, simple, integer power function for Swift. By default Swift does not ship with a `pow` function that takes two `Int` arguments.
//
// IntPow.swift
//
// Created by Khan Winter on 5/1/25.
//
/// Raises an integer to a positive power.
@inlinable
public func pow(_ base: Int, _ exp: UInt) -> Int {
var exp = exp
@thecoolwinter
thecoolwinter / HashableEncoder.swift
Created June 22, 2025 19:48
Hashable Encodable
//
// HashableEncoder.swift
// Anchor
//
// Copyright (C) 2025 Khan Winter
//
import Foundation
import Crypto
@thecoolwinter
thecoolwinter / TaskGroup+addTasks.swift
Last active July 20, 2025 04:00
Swift extension on Swift Concurrency's task group to process an array of data in parallel, with logic for setting a maximum number of parallel items to process at once.
//
// TaskGroup+addTasks.swift
// Anchor
//
// Copyright (C) 2025 Khan Winter
//
extension TaskGroup {
/// Add tasks to a task group using an array of data, and set a maximum number of parallel tasks to enqueue.
///