Skip to content

Instantly share code, notes, and snippets.

@fourst4r
fourst4r / SparseMatrix.hx
Created August 25, 2023 06:40
SparseMatrix
@:allow(SparseMatrixIterator)
@:allow(SparseMatrixKeyValueIterator)
class SparseMatrix<T> {
final _rows:Array<Int>;
final _cols:Array<Int>;
final _values:Array<T>;
public function new() {
_rows = new Array();
module multiformattedtext;
/************************************************************************
*
* File: MultiformattedText.cpp
*
* Description:
*
*
* This file is part of the Microsoft Windows SDK Code Samples.
const gdi32 = @import("gdi32.zig");
pub usingnamespace @import("std").os.windows;
pub const VOID = c_void;
pub const HWND = HANDLE;
pub const WPARAM = UINT_PTR;
pub const LPARAM = LONG_PTR;
pub const LRESULT = LONG_PTR;
pub const HICON = HANDLE;
pub const HCURSOR = HICON;
usingnamespace @import("bits.zig");
pub const CW_USEDEFAULT: DWORD = 0x80000000;
// https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
pub const WS_OVERLAPPED = 0x00000000;
pub const WS_POPUP = 0x80000000;
pub const WS_CHILD = 0x40000000;
pub const WS_MINIMIZE = 0x20000000;
pub const WS_VISIBLE = 0x10000000;
// Useful for AES encryption.
// Pad the ciphertext with zeros until it is of length blockSize.
func ZerosPad(ciphertext []byte, blockSize int) []byte {
// determine number of zeros to add
padLen := blockSize - (len(ciphertext) % blockSize)
padText := bytes.Repeat([]byte{0}, padLen)
ciphertext = append(ciphertext, padText...)