Skip to content

Instantly share code, notes, and snippets.

<protocol>
<types>
<token name="handler_token" type="int32"/>
<token name="window_token" type="int32"/>
<token name="bitmap_token" type="int32"/>
<token name="picture_token" type="int32"/>
<token name="cursor_token" type="int32"/>
<struct name="rgb_color" header="GraphicsDefs.h">
<field name="red" type="uint8"/>
@X547
X547 / ContainerOf.h
Created November 12, 2025 23:38
C++ traits with stable ABI
#pragma once
#include <stddef.h>
#include <stdint.h>
template <class T, class M>
static inline constexpr ptrdiff_t OffsetOf(const M T::*member)
{
return reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<T*>(0)->*member));
@X547
X547 / RopeList.cpp
Created October 16, 2025 22:23
RopeList
#include "RopeList.h"
#include <assert.h>
#include <stdio.h>
#include <algorithm>
RopeList::RopeList()
:
fRoot(NULL)
version: 2
unknown: 0
ops:
- ENTER_STATE_CHANGE:
- SET_PEN_LOCATION:
x: 0.0
y: 0.0
@X547
X547 / Canvas.h
Created May 18, 2025 23:55
app_server_neo Canvas interface
#pragma once
#include <string_view>
#include <optional>
#include <Point.h>
#include <Rect.h>
#include <Region.h>
#include <Shape.h>
#include <Font.h>
NV01_ROOT(0)
NV01_ROOT_CLIENT(0xc1d00354)
NV01_DEVICE_0(0xbeef0003)
NV20_SUBDEVICE_0(0xbeef0004)
VOLTA_USERMODE_A(0xbeefc360)
RM_USER_SHARED_DATA(0xbeef00de)
GF100_ZBC_CLEAR(0xbeef9960)
NV01_EVENT(0x15)
NV01_EVENT(0x17)
NV01_EVENT(0x18)
<protocol>
<types>
<token name="handler_token" type="int32"/>
<token name="window_token" type="int32"/>
<token name="bitmap_token" type="int32"/>
<token name="picture_token" type="int32"/>
<token name="cursor_token" type="int32"/>
<struct name="rgb_color" header="GraphicsDefs.h">
<field name="red" type="uint8"/>
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include "Wayland.h"
#include "XdgShell.h"
#include "linux/input-event-codes.h"
extern "C" {
profiling results for thread "dd" (1585):
tick interval: 100 us
total ticks: 134989 (13498900 us)
expected ticks: 144035 (missed 9046)
unknown ticks: 0 (0 us, 0.00%)
dropped ticks: 1014 (101400 us, 0.75%)
hits unknown image
------------------------------------------------------------------------------
131944 0 1 kernel_x86_64
@X547
X547 / RadixTreeMap.cpp
Created August 27, 2024 22:02
RadixTree
#include "RadixTreeMap.h"
#include <new>
#include <algorithm>
#include <AutoDeleter.h>
#include "BitUtils.h"
#define CHECK_RET(err) {status_t _err = (err); if (_err < B_OK) return _err;}