Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › heap › SafeAllocator › AllocFooter › Modify Private Enum Modify Doc Source Private Enum std.heap.SafeAllocator.AllocFooter.Modify
const Modify = enum (u16 ) Functions File heap/SafeAllocator.zig: 328
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364 const Modify = enum (u16 ) {
// Random non-linear enum values to decrease the chance of undetected corruption.
none = 0x2962 ,
resized = 0x0030 ,
remaped = 0x9068 ,
freeing = 0x7f3d ,
freed = 0xb98b ,
_ ,
fn setNone (m : *Modify ) void {
_ = @atomicRmw (Modify , m , .Xchg , .storedXor (.none , m ), .monotonic );
}
fn opName (m : Modify ) []const u8 {
return switch (m ) {
.resized => "resize" ,
.remaped => "remap" ,
.freeing => "free" ,
_ , .none , .freed => unreachable ,
};
}
fn stateName (m : Modify ) []const u8 {
return switch (m ) {
.resized => "after resize" ,
.remaped => "after remap" ,
.freeing => "during free" ,
.freed => "after free" ,
_ , .none => unreachable ,
};
}
fn storedXor (m : Modify , ptr : *Modify ) Modify {
const addr_hash : u16 = @truncate (std .hash .int (@intFromPtr (ptr )));
return @fromBackingInt (@intCast (@backingInt (m ) ^ addr_hash ));
}
}