stb single-file public domain libraries for C/C++

stb

single-file public domain (or MIT licensed) libraries for C/C++

Noteworthy:

Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.

library lastest version category LoC description
stb_vorbis.c 1.20 audio 5563 decode ogg vorbis files from file/memory to float/16-bit signed output
stb_image.h 2.26 graphics 7762 image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
stb_truetype.h 1.24 graphics 5011 parse, decode, and rasterize characters from truetype fonts
stb_image_write.h 1.15 graphics 1690 image writing to disk: PNG, TGA, BMP
stb_image_resize.h 0.96 graphics 2631 resize images larger/smaller with good quality
stb_rect_pack.h 1.00 graphics 628 simple 2D rectangle packer with decent quality
stb_ds.h 0.65 utility 1880 typesafe dynamic array and hash tables for C, will compile in C++
stb_sprintf.h 1.09 utility 1879 fast sprintf, snprintf for C/C++
stretchy_buffer.h 1.04 utility 263 typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
stb_textedit.h 1.13 user interface 1404 guts of a text editor for games etc implementing them from scratch
stb_voxel_render.h 0.89 3D graphics 3807 Minecraft-esque voxel rendering "engine" with many more features
stb_dxt.h 1.10 3D graphics 753 Fabian "ryg" Giesen's real-time DXT compressor
stb_perlin.h 0.5 3D graphics 428 revised Perlin noise (3D input, 1D output)
stb_easy_font.h 1.1 3D graphics 305 quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
stb_tilemap_editor.h 0.41 game dev 4161 embeddable tilemap editor
stb_herringbone_wa... 0.7 game dev 1221 herringbone Wang tile map generator
stb_c_lexer.h 0.11 parsing 966 simplify writing parsers for C-like languages
stb_divide.h 0.93 math 430 more useful 32-bit modulus e.g. "euclidean divide"
stb_connected_comp... 0.96 misc 1049 incrementally compute reachability on grids
stb.h 2.37 misc 14454 helper functions for C, mostly redundant in C++; basically author's personal stuff
stb_leakcheck.h 0.6 misc 194 quick-and-dirty malloc/free leak-checking
stb_include.h 0.02 misc 295 implement recursive #include support, particularly for GLSL

Total libraries: 22 Total lines of C code: 56774

FAQ

What's the license?

These libraries are in the public domain. You can do anything you want with them. You have no legal obligation to do anything else, although I appreciate attribution.

They are also licensed under the MIT open source license, if you have lawyers who are unhappy with public domain. Every source file includes an explicit dual-license for you to choose from.

Are there other single-file public-domain/open source libraries with minimal dependencies out there?

Yes.

If I wrap an stb library in a new library, does the new library have to be public domain/MIT?

No, because it's public domain you can freely relicense it to whatever license your new library wants to be.

What's the deal with SSE support in GCC-based compilers?

stb_image will either use SSE2 (if you compile with -msse2) or will not use any SIMD at all, rather than trying to detect the processor at runtime and handle it correctly. As I understand it, the approved path in GCC for runtime-detection require you to use multiple source files, one for each CPU configuration. Because stb_image is a header-file library that compiles in only one source file, there's no approved way to build both an SSE-enabled and a non-SSE-enabled variation.

While we've tried to work around it, we've had multiple issues over the years due to specific versions of gcc breaking what we're doing, so we've given up on it. See https://github.com/nothings/stb/issues/280 and https://github.com/nothings/stb/issues/410 for examples.

Some of these libraries seem redundant to existing open source libraries. Are they better somehow?

Generally they're only better in that they're easier to integrate, easier to use, and easier to release (single file; good API; no attribution requirement). They may be less featureful, slower, and/or use more memory. If you're already using an equivalent library, there's probably no good reason to switch.

Can I link directly to the table of stb libraries?

You can use this URL to link directly to that list.

Why do you list "lines of code"? It's a terrible metric.

Just to give you some idea of the internal complexity of the library, to help you manage your expectations, or to let you know what you're getting into. While not all the libraries are written in the same style, they're certainly similar styles, and so comparisons between the libraries are probably still meaningful.

Note though that the lines do include both the implementation, the part that corresponds to a header file, and the documentation.

Why single-file headers?

Windows doesn't have standard directories where libraries live. That makes deploying libraries in Windows a lot more painful than open source developers on Unix-derivates generally realize. (It also makes library dependencies a lot worse in Windows.)

There's also a common problem in Windows where a library was built against a different version of the runtime library, which causes link conflicts and confusion. Shipping the libs as headers means you normally just compile them straight into your project without making libraries, thus sidestepping that problem.

Making them a single file makes it very easy to just drop them into a project that needs them. (Of course you can still put them in a proper shared library tree if you want.)

Why not two files, one a header and one an implementation? The difference between 10 files and 9 files is not a big deal, but the difference between 2 files and 1 file is a big deal. You don't need to zip or tar the files up, you don't have to remember to attach two files, etc.

Why "stb"? Is this something to do with Set-Top Boxes?

No, they are just the initials for my name, Sean T. Barrett. This was not chosen out of egomania, but as a moderately sane way of namespacing the filenames and source function names.

Will you add more image types to stb_image.h?

No. As stb_image use has grown, it has become more important for us to focus on security of the codebase. Adding new image formats increases the amount of code we need to secure, so it is no longer worth adding new formats.

Do you have any advice on how to create my own single-file library?

Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt

Why public domain?

I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons. Some of them are listed here: https://github.com/nothings/stb/blob/master/docs/why_public_domain.md

Why C?

Primarily, because I use C, not C++. But it does also make it easier for other people to use them from other languages.

Why not C99? stdint.h, declare-anywhere, etc.

I still use MSVC 6 (1998) as my IDE because it has better human factors for me than later versions of MSVC.

Comments
  • Requested libraries

    Requested libraries

    THIS THREAD IS FOR REQUESTING LIBRARIES, NOT FOR ADDITIONS TO OTHER_LIBS.

    Over the years, people have suggested the following ideas for stb libraries. Here are your options for these libraries, where appropriate.

    • ~~lexer~~
    • ~~image resizer~~
    • matrix library -- stb_vec.h is the beginnings of one
    • zip file handler -- consider miniz
    • flac audio decoder
    • adpcm audio decoder
    • Opus audio decoder -- why there is no stb_opus
    • crypto library -- consider TweetNaCl
    • wide-line rendering -- I have a bad version of this coming, need to think about good version
    • triangle-soup raycaster
    • key/value store
    • json parser -- consider one of the 4+ JSON parsers here
    • http -- consider one of the server or client libraries here
    • plotting & graphing -- I need to finish up stb_plot.h
    • unicode text shaping -- (Harfbuzz et al) my best guess from researching is that this isn't sufficiently documented in official Unicode documents (and other English documents) to write it purely from specs; needs language-specific expertise for each supported language
    • software-rendered photoshop layer & filter effects
    • pdb parsing/processing -- the "specification" is primarily source code, so this has the same problem as Opus above
    • C preprocessor -- consider fcpp; also, I actually need this for a C-with-statically-typed-NULL-checking tool I've been working on on-and-off, so I might do it
    • PhysFS-esque pak-file-esque handler with pluggable back-ends
    • JPEG RGBA file format
    • regex matching using stb's boyer-moore-esque SGREP algorithm
    • FFT -- consider KISS FFT
    • arbitrary precision math
    • portable networking
    • portable threading -- consider mts
    • SVD
    • speech synthesizer
    • fbx/obj/blender 3d-model loader -- consider https://github.com/syoyo/tinyobjloader
    • non-linear least squares and general solver, a la http://ceres-solver.org/
    • HAMT or other sophisticated data structure
    • mp3 decoder useful once the patents expire soon-ish
    • html paser/renderer
  • support for seeking in stb_vorbis.c  (payment)

    support for seeking in stb_vorbis.c (payment)

    Someone has currently declared their intent to pursue this. Historically, multiple people have looked at this and given up, though, so it may re-open.

    stb_vorbis is this single-file C library for decoding ogg vorbis files: https://github.com/nothings/stb/blob/master/stb_vorbis.c

    stb_vorbis doesn't have correctly-working seek functionality (e.g. being able to say 'start playback from sample number 31415926').

    The payment for a correct implementation of this feature is 5000 USD. (It may go down again in a few months as the current amount is the sum of several individuals who may drop out if it doesn't get done soon enough.) Please let me know if you are working on it to make sure we don't end up with two people doing it at the same time, as only one correct implementation will be paid out.

    Requirements:

    • seeking must be sample-accurate
    • reasonably efficient (binary search, interpolation search, etc)
    • cannot generate an off-line index or scan the whole file at start
    • changes must be placed in the public domain
    • you can start with the existing non-working implementation of seek (see below) or start from scratch
    • you'll need to learn about both the ogg specification and the vorbis specification to do this (see the link below for some insight why)
    • I (@nothings) am available to provide guidance about what the existing code is doing (aka write better comments)

    Current status in the code:

    • there is a 2007 implementation of seeking in the code which doesn't work. I no longer remember the details of how it doesn't work. I wrote this document about the frustrations of trying to do a performance-optimal implementation: http://nothings.org/stb_vorbis/ogg_seek.txt but at this point I will accept some suboptimality.
    • the "pushdata" API supports an approximate seeking; this is satisfactory for the pushdata API but not for the normal ("pulldata") API. you can just ignore the pushdata case
  • Crash with Floating Point Exception (Code 8) on bitmap load

    Crash with Floating Point Exception (Code 8) on bitmap load

    I've run into a floating point exception (code 8) trying to stbi_load a bitmap image, which loads if I save the image as a png or jpeg. I was able to run the program fine on my Linux distro (Ubuntu 17.04) but not on macOS Sierra.

    This is the image: https://drive.google.com/file/d/0B1z6l9DJ0EySbExqTFpkM0FkWk0/view?usp=sharing

  • SSE2 jpeg decoding segfaults in mingw 32 bit builds

    SSE2 jpeg decoding segfaults in mingw 32 bit builds

    Hi Sean!

    I received a bug report on one of my libraries that relies on stb_image to do the image decoding. It took me a while to understand what was happening since i couldn't reproduce it, until the user mentioned that it was building for 32bits with mingw32 ( and i was building 64 bit builds ).

    It seems that the jpeg SSE2 decoder is failing strangely, since if i build with VC works just fine. Here's an image of the callstack when fails: fail.

    Here's a project to test the issue.

    I've also tested to cross-compile the project from linux and it also happens. I must say that i know nothing about SSE2 so i really can't help much with the bug. And AFAIK it's a 32bit mingw only problem, no problems so far in 32 or 64 bit builds in linux, and if i remember correctly, no problems in os x neither.

    Edit: I tried compiling with "-msse -msse2" enabled but didn't help.

    Regards

  • stb_image: add png fuzz target

    stb_image: add png fuzz target

    This adds a fuzz target, dictionary and iphone png's for fuzzing the png reader. My plan is to eventually integrate with OSS-Fuzz which would continuously fuzz the code in stb_image.h.

  • stb_image and stb_image_write: allow to use zlib for png compression

    stb_image and stb_image_write: allow to use zlib for png compression

    I noticed that the zlib compression in stb_image_write was rather poor compared to what the actual zlib library would do. For example saving an rgba image filled with the gray color (128,128,128,255) prodices a png of size 42KB. When I use zlib to compress the data instead of stb algorithm, I get 6.4KB.

    Many projects already use zlib, so I think having the option to use it would be nice, if that is not too much work.

  • Error compiling stb.h in visual studio

    Error compiling stb.h in visual studio

    Hello I am having problems compiling stb.h Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64 stb.h version 2.30 Here are my includes just in case one of them is the problem

    #define STB_DEFINE
    #include "stb.h"
    #include "sdl/include/SDL.h"
    #define STB_IMAGE_IMPLEMENTATION
    #include "stb_image.h"
    #include <stdint.h>
    #include <cmath>
    #include "platform.h"
    
    #include <limits> 
    

    compile script

    
    cl -Od -Zo -Z7 ..\seville\win32_main.cpp -Fmwin32_main.map /link  -incremental:no -opt:ref user32.lib gdi32.lib winmm.lib opengl32.lib ..\seville\sdl\lib\x64\sdl2.lib
    

    here are the errors I get

    Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    win32_main.cpp
    c:\users\computer\games\seville\stb.h(3365): warning C4311: 'type cast': pointer truncation from 'void *' to 'unsigned int'
    c:\users\computer\games\seville\stb.h(3414): warning C4311: 'type cast': pointer truncation from 'unsigned char *' to 'int'
    c:\users\computer\games\seville\stb.h(3740): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(3759): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(3767): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(6528): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
    c:\users\computer\games\seville\stb.h(6530): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
    c:\users\computer\games\seville\stb.h(6963): error C2665: 'swprintf': none of the 2 overloads could convert all the argument types
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_wstdio.h(1820): note: could be 'int swprintf(wchar_t *const ,const wchar_t *const ,...) throw()'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_wstdio.h(1463): note: or       'int swprintf(wchar_t *const ,const ::size_t,const wchar_t *const ,...)'
    c:\users\computer\games\seville\stb.h(6963): note: while trying to match the argument list '(stb__wchar [1024], int, const wchar_t [4], stb__wchar *)'
    c:\users\computer\games\seville\stb.h(6965): error C2665: 'swprintf': none of the 2 overloads could convert all the argument types
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_wstdio.h(1820): note: could be 'int swprintf(wchar_t *const ,const wchar_t *const ,...) throw()'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_wstdio.h(1463): note: or       'int swprintf(wchar_t *const ,const ::size_t,const wchar_t *const ,...)'
    c:\users\computer\games\seville\stb.h(6965): note: while trying to match the argument list '(stb__wchar [1024], int, const wchar_t [5], stb__wchar *)'
    c:\users\computer\games\seville\stb.h(6983): error C2664: 'intptr_t _wfindfirst64(const wchar_t *,_wfinddata64_t *)': cannot convert argument 1 from 'stb__wchar [1024]' to 'const wchar_t *'
    c:\users\computer\games\seville\stb.h(6983): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\users\computer\games\seville\stb.h(6990): error C2664: 'char *stb__to_utf8(stb__wchar *)': cannot convert argument 1 from 'wchar_t [260]' to 'stb__wchar *'
    c:\users\computer\games\seville\stb.h(6990): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\users\computer\games\seville\stb.h(7007): error C2664: 'char *stb__to_utf8(stb__wchar *)': cannot convert argument 1 from 'wchar_t [260]' to 'stb__wchar *'
    c:\users\computer\games\seville\stb.h(7007): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\users\computer\games\seville\stb.h(7045): warning C4477: 'printf' : format string '%08x' requires an argument of type 'unsigned int', but variadic argument 2 has type 'time_t'
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%llx' in the format string
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%Ix' in the format string
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%I64x' in the format string
    c:\users\computer\games\seville\stb.h(7045): warning C4477: 'printf' : format string '%08x' requires an argument of type 'unsigned int', but variadic argument 3 has type '__time64_t'
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%llx' in the format string
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%Ix' in the format string
    c:\users\computer\games\seville\stb.h(7045): note: consider using '%I64x' in the format string
    c:\users\computer\games\seville\stb.h(7634): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7641): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7653): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7680): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7681): warning C4311: 'type cast': pointer truncation from 'void *' to 'int'
    c:\users\computer\games\seville\stb.h(7722): warning C4311: 'type cast': pointer truncation from 'void *' to 'int'
    c:\users\computer\games\seville\stb.h(7726): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7775): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7779): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7806): warning C4311: 'type cast': pointer truncation from 'void *' to 'int'
    c:\users\computer\games\seville\stb.h(7808): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7867): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7889): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7922): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7943): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(7969): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(7981): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(8003): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(8017): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(8039): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(8050): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(8074): warning C4311: 'type cast': pointer truncation from 'stb_ps *' to 'int'
    c:\users\computer\games\seville\stb.h(9121): warning C4838: conversion from 'int' to 'stb_int16' requires a narrowing conversion
    c:\users\computer\games\seville\stb.h(9121): warning C4838: conversion from 'int' to 'stb_uint16' requires a narrowing conversion
    c:\users\computer\games\seville\stb.h(9834): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(9865): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(9866): warning C4311: 'type cast': pointer truncation from 'char *' to 'int'
    c:\users\computer\games\seville\stb.h(10623): warning C4838: conversion from 'stb_uint' to 'stb_uchar' requires a narrowing conversion
    c:\users\computer\games\seville\stb.h(12373): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(12373): warning C4312: 'type cast': conversion from 'stb_uint32' to 'stb__span **' of greater size
    c:\users\computer\games\seville\stb.h(12392): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(12392): warning C4312: 'type cast': conversion from 'stb_uint32' to 'stb__span *' of greater size
    c:\users\computer\games\seville\stb.h(12473): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint32'
    c:\users\computer\games\seville\stb.h(12551): warning C4312: 'type cast': conversion from 'int' to 'char *' of greater size
    c:\users\computer\games\seville\stb.h(12628): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
    c:\users\computer\games\seville\stb.h(12648): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint'
    c:\users\computer\games\seville\stb.h(12661): warning C4311: 'type cast': pointer truncation from 'void *' to 'stb_uint'
    

    Thanks for any help or insight you can give.

  • stb_image can't load these png files (but they view OK in any other app)

    stb_image can't load these png files (but they view OK in any other app)

    I saved some png files on OSX. Via the screen capture, but also via resaving the file in Apple's Preview.app. And now the files don't load properly in stb_image.

    stb_fail1 stb_fail2 stb_fail3

  • stb_image is it thread safe?

    stb_image is it thread safe?

    Hi, I am using stb_image to load texture for my game engine, all works nice and dandy but I am getting what I believe being race conditions inside stbi_load and I would like to know If that function is thread safe. What I am doing is really simple:

    auto data= stbi_load(path,&m_width, &m_height, 0, 0);

    This is at the start of my own Texture::load, that class is allocated on the heap right before calling the load, so no race condition can happen there ,the first line in load() is the stbi_load function you see. From time to time, an assertion from stbi_load (or any nested func call), is being triggered. The assertion is the following:

    Assertion failed: z->size[b] == s, file E:\WORK_IN_PROGRESS\C\libs\Simple-OpenGL-Image-Library\src\stb_image_aug.c, line 1750

    Which looking at the current version i have (to be honest the stb_image i am using came from SOIL, but i have bypassed it completely and called stb_image directly):

    `__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z) { int b,s,k; if (a->num_bits < 16) fill_bits(a); b = z->fast[a->code_buffer & ZFAST_MASK]; if (b < 0xffff) { s = z->size[b]; a->code_buffer >>= s; a->num_bits -= s; return z->value[b]; }

    // not resolved by fast table, so compute it the slow way // use jpeg approach, which requires MSbits at top k = bit_reverse(a->code_buffer, 16); for (s=ZFAST_BITS+1; ; ++s) if (k < z->maxcode[s]) break; if (s == 16) return -1; // invalid code! // code size is s, so: b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; assert(z->size[b] == s); a->code_buffer >>= s; a->num_bits -= s; return z->value[b]; }`

    Now anyone know what could be triggering this? If I move just the stbi_func call inside a lock everything works perfectly, so I would be curious to know whats going on and how to prevent the assertion, having texture loading inside a lock is less than ideal and would rather avoid it.

  • Fix the calculation of the input image shift when using subpixel regions

    Fix the calculation of the input image shift when using subpixel regions

    Includes some more tests which had incorrect results before, but work fine with the included fixes. The test does a subpixel region that slides from [0, 0.5] to [0.5, 1] for both upsampling and downsampling. I think that should cover all of the uses of the subpixel stuff. I'm not bothering with s < 0 or t > 1 because I don't think we ever intended to support that in the first place. At the very least, non-subpixel stuff is unaffected because s0 = t0 = 0 means in_shift = 0.

  • stb_ds.h fails unit tests gcc 11.3.0

    stb_ds.h fails unit tests gcc 11.3.0

    I tired running the unit test after getting unexpected results when compiling with address sanitizer. It failed one test. main.c

    #define STB_DS_IMPLEMENTATION
    #define STBDS_UNIT_TESTS
    #include "stb_ds.h"
    
    int main(int argc, char const *argv[])
    {
        stbds_unit_tests();
        return 0;
    }
    

    gcc main.c

    a.out: src/stb_ds.h:1847: stbds_unit_tests: Assertion `hmgets(map3, s.key).d == i*5' failed.

    I expected a piece in my game to move to its valid location, but it did not. I suspect it was a failed call to hmgeti(game->valid_actions, *action) != -1. The bug manifests itself in several ways. If i compile with no -fsanitize=address it appears to work. I checked the hashmap by iterating over it and it did have my entry but when using hmgeti it does not find it.

    Relevant structures.

    typedef struct Position {
        int q;
        int r;
        int s;
    } Position;
    
    typedef struct Action {
        char piece;
        Position source;
        Position destination;
    } Action;
    
    typedef struct ActionHashMapEntry {
        Action key;
    } ActionHashMapEntry;
    
    #define COLUMNS 127
    #define ROWS 127
    #define LAYERS 7
    #define SPACES (COLUMNS * ROWS * LAYERS)
    
    typedef struct Game {
        Position positions[PIECES];
        char board[SPACES];
        int current_turn;
        int pieces_in_play;
        Action *history;
        ActionHashMapEntry *valid_actions;
    } Game;
    

    I Create a hashmap of ActionHashMapEntrys.

    Game game = {0}; // Init game.valid_actions to NULL
    

    I insert and query for ActionHashMapEntrys

    Action action = {piece, piece_position, adjacent_position};
    hmputs(game->valid_actions, (ActionHashMapEntry){action});
    
    hmgeti(game->valid_actions, *action) != -1;
    

    I free and resuse the hashmap.

    hmfree(game.valid_actions);
    
    for(int i = 1; i < PIECES; ++i)
    {
        game_generate_moves_for_piece(&game, i);
    }
    

    I never pass the pointer to the hashmap directly it is always referenced by the Game structure.

  • stb_image.h: gcc link error in stbi__parse_zlib when using -fsanitize=address

    stb_image.h: gcc link error in stbi__parse_zlib when using -fsanitize=address

    Describe the bug gcc errors when using -fsanitize=address

    To Reproduce Steps to reproduce the behavior:

    • include nanogui in cmake project
    • set CMAKE_CXX_FLAGS_RELEASE to include -fsanitize=address
    • compile with gcc passing -fsanitize=address at compile
    • occurs with both -O3 and -Og

    Versions:

    • stb_image.h:
      • v2.10
      • v2.27
    • gcc 11.2:
    [email protected]:~/cgrt$ gcc --version
    gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    File including stb_image.h compilation output:

    [ 81%] Building CXX object ext/nanogui/CMakeFiles/nanogui.dir/src/texture.cpp.o
    cd /home/chris/cgrt/build/ext/nanogui && /usr/bin/c++ -DNANOGUI_BUILD -DNANOGUI_SHARED -DNANOGUI_USE_OPENGL -DNVG_BUILD -DNVG_SHARED -DNVG_STB_IMAGE_IMPLEMENTATION -D_GLFW_BUILD_DLL -I/home/chris/cgrt/build/ext/nanogui -I/home/chris/cgrt/ext/nanogui/include -I/home/chris/cgrt/ext/nanogui/ext/nanovg/src -I/home/chris/cgrt/ext/nanogui/ext/glfw/include -Wall -Wextra -O3 -DNDEBUG -fsanitize=address -O3 -ffast-math -march=native -Wall -Werror -fpermissive -flto -fno-fat-lto-objects -fPIC -fvisibility=hidden -march=nehalem -MD -MT ext/nanogui/CMakeFiles/nanogui.dir/src/texture.cpp.o -MF CMakeFiles/nanogui.dir/src/texture.cpp.o.d -o CMakeFiles/nanogui.dir/src/texture.cpp.o -c /home/chris/cgrt/ext/nanogui/src/texture.cpp
    

    The file only uses stbi_load and stbi_image_free


    Linker output:

    cd /home/chris/cgrt/build/ext/nanogui && /usr/bin/cmake -E cmake_link_script CMakeFiles/nanogui.dir/link.txt --verbose=1
    /usr/bin/c++ -fPIC  -Wall -Wextra -O3 -DNDEBUG -fsanitize=address -ggdb -O3 -ffast-math -march=native -Wall -Werror -fpermissive -flto -fno-fat-lto-objects -shared -Wl,-soname,libnanogui.so -o ../../bin/libnanogui.so CMakeFiles/nanogui.dir/ext/nanovg/src/nanovg.c.o CMakeFiles/nanogui.dir/src/texture_gl.cpp.o CMakeFiles/nanogui.dir/src/shader_gl.cpp.o CMakeFiles/nanogui.dir/src/renderpass_gl.cpp.o CMakeFiles/nanogui.dir/src/opengl.cpp.o CMakeFiles/nanogui.dir/nanogui_resources.cpp.o CMakeFiles/nanogui.dir/src/common.cpp.o CMakeFiles/nanogui.dir/src/widget.cpp.o CMakeFiles/nanogui.dir/src/theme.cpp.o CMakeFiles/nanogui.dir/src/layout.cpp.o CMakeFiles/nanogui.dir/src/screen.cpp.o CMakeFiles/nanogui.dir/src/label.cpp.o CMakeFiles/nanogui.dir/src/window.cpp.o CMakeFiles/nanogui.dir/src/popup.cpp.o CMakeFiles/nanogui.dir/src/checkbox.cpp.o CMakeFiles/nanogui.dir/src/button.cpp.o CMakeFiles/nanogui.dir/src/popupbutton.cpp.o CMakeFiles/nanogui.dir/src/combobox.cpp.o CMakeFiles/nanogui.dir/src/progressbar.cpp.o CMakeFiles/nanogui.dir/src/slider.cpp.o CMakeFiles/nanogui.dir/src/messagedialog.cpp.o CMakeFiles/nanogui.dir/src/textbox.cpp.o CMakeFiles/nanogui.dir/src/textarea.cpp.o CMakeFiles/nanogui.dir/src/imagepanel.cpp.o CMakeFiles/nanogui.dir/src/vscrollpanel.cpp.o CMakeFiles/nanogui.dir/src/colorwheel.cpp.o CMakeFiles/nanogui.dir/src/colorpicker.cpp.o CMakeFiles/nanogui.dir/src/graph.cpp.o CMakeFiles/nanogui.dir/src/tabwidget.cpp.o CMakeFiles/nanogui.dir/src/canvas.cpp.o CMakeFiles/nanogui.dir/src/texture.cpp.o CMakeFiles/nanogui.dir/src/shader.cpp.o CMakeFiles/nanogui.dir/src/imageview.cpp.o CMakeFiles/nanogui.dir/src/traits.cpp.o ext/glfw/src/CMakeFiles/glfw_objects.dir/context.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/init.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/input.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/monitor.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/vulkan.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/window.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/x11_init.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/x11_monitor.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/x11_window.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/xkb_unicode.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/posix_time.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/posix_thread.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/glx_context.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/egl_context.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/osmesa_context.c.o ext/glfw/src/CMakeFiles/glfw_objects.dir/linux_joystick.c.o  -lX11 -lpthread -lGL -lrt -ldl
    In function ‘stbi__parse_uncompressed_block’,
        inlined from ‘stbi__parse_zlib’ at /home/chris/cgrt/ext/nanogui/ext/nanovg/src/stb_image.h:4415:15:
    /home/chris/cgrt/ext/nanogui/ext/nanovg/src/stb_image.h:4348:19: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
     4348 |       header[k++] = stbi__zget8(a);
          |                   ^
    /home/chris/cgrt/ext/nanogui/ext/nanovg/src/stb_image.h: In function ‘stbi__parse_zlib’:
    /home/chris/cgrt/ext/nanogui/ext/nanovg/src/stb_image.h:4334:12: note: at offset 4 into destination object ‘header’ of size 4
     4334 |    stbi_uc header[4];
          |            ^
    lto1: all warnings being treated as errors
    lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status
    compilation terminated.
    /usr/bin/ld: error: lto-wrapper failed
    collect2: error: ld returned 1 exit status
    gmake[3]: *** [ext/nanogui/CMakeFiles/nanogui.dir/build.make:678: bin/libnanogui.so] Error 1
    gmake[3]: Leaving directory '/home/chris/cgrt/build'
    gmake[2]: *** [CMakeFiles/Makefile2:416: ext/nanogui/CMakeFiles/nanogui.dir/all] Error 2
    gmake[2]: Leaving directory '/home/chris/cgrt/build'
    gmake[1]: *** [CMakeFiles/Makefile2:790: src/cgrt-cuda/CMakeFiles/cgrt-cuda.dir/rule] Error 2
    gmake[1]: Leaving directory '/home/chris/cgrt/build'
    gmake: *** [Makefile:377: cgrt-cuda] Error 2
    

    Let me know if there's any additional information that I can supply, or anything I can do to help debug

  • UBSAN: implicit conversion and unsigned integer overflows

    UBSAN: implicit conversion and unsigned integer overflows

    UBSAN: implicit conversion and unsigned integer overflows

    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4274:37: runtime error: implicit conversion from type 'stbi_uc' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type 'char' changed the value to -1 (8-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4274:37 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4276:37: runtime error: implicit conversion from type 'stbi_uc' (aka 'unsigned char') of value 253 (8-bit, unsigned) to type 'char' changed the value to -3 (8-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4276:37 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4171:26: runtime error: implicit conversion from type 'stbi__uint32' (aka 'unsigned int') of value 4038909751 (32-bit, unsigned) to type 'int' changed the value to -256057545 (32-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:4171:26 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3306:83: runtime error: implicit conversion from type 'int' of value -16 (32-bit, signed) to type 'unsigned long' changed the value to 18446744073709551600 (64-bit, unsigned)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3306:83 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:1998:23: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:1998:23 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:1998:21: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:1998:21 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2043:26: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2043:26 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2139:15: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2139:15 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2139:11: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2139:11 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2114:58: runtime error: implicit conversion from type 'int' of value -991 (32-bit, signed) to type 'unsigned int' changed the value to 4294966305 (32-bit, unsigned)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2114:58 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2114:56: runtime error: unsigned integer overflow: 1017 + 4294966305 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:2114:56 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3749:56: runtime error: implicit conversion from type 'int' of value -360960 (32-bit, signed) to type 'unsigned int' changed the value to 4294606336 (32-bit, unsigned)
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3749:56 in 
    /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3749:53: runtime error: unsigned integer overflow: 266113792 + 4294574080 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/dani/Desktop/graphiland-server/build/_deps/stb_image-src/stb_image.h:3749:53 in 
    [1] + Done                       "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-mvweso40.obs" 1>"/tmp/Microsoft-MIEngine-Out-t5mtgnum.f3l"
    

    To Reproduce Steps to reproduce the behavior:

    #include <GL/glew.h>
    #include <GLFW/glfw3.h>
    #define STB_IMAGE_IMPLEMENTATION
    #include <stb_image.h>
    
    #include <iostream>
    #include <string>
    
    class Texture {
     private:
        GLuint TBO{};
    
     public:
        explicit Texture(std::string path) {
            glGenTextures(1, &TBO);
    
            int width, height, nrComponents;
            unsigned char* data = stbi_load(path.c_str(), &width, &height, &nrComponents, 0);
            if (data) {
                GLint format = 0;
                if (nrComponents == 1) {
                    format = GL_RED;
                } else if (nrComponents == 3) {
                    format = GL_RGB;
                } else if (nrComponents == 4) {
                    format = GL_RGBA;
                }
    
                glBindTexture(GL_TEXTURE_2D, TBO);
                glTexImage2D(GL_TEXTURE_2D,
                             0,
                             format,
                             width,
                             height,
                             0,
                             static_cast<GLenum>(format),
                             GL_UNSIGNED_BYTE,
                             data);
                glGenerateMipmap(GL_TEXTURE_2D);
    
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    
                stbi_image_free(data);
            } else {
                std::cerr << "Texture failed to load at path: " << path << "\n";
                stbi_image_free(data);
            }
        }
    
        void bind() {
            glBindTexture(GL_TEXTURE_2D, TBO);
        }
    
        ~Texture() {
            glDeleteTextures(1, &TBO);
        }
    };
    
    int main() {
        glfwInit();
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    
        GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Graphiland", nullptr, nullptr);
        if (window == nullptr) {
            std::cerr << "Failed to create GLFW window.\n";
            glfwTerminate();
            return -1;
        }
        glfwMakeContextCurrent(window);
    
        GLenum err = glewInit();
        if (GLEW_OK != err) {
            std::cerr << "Error: " << glewGetErrorString(err) << "\n";
            return -1;
        }
    
        Texture fortressTexture("fortress_tower.png");  // use any image 
    
        glfwTerminate();
        return 0;
    }
    

    Compile this file with clang++ with the following flags then run it. Flags: -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wnon-virtual-dtor -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wconversion -Wdouble-promotion -Wnull-dereference -Wsign-promo -Wstrict-overflow=5 -Wunused -Wswitch-default -Wctor-dtor-privacy -Wundef -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=unsigned-integer-overflow -fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability -fno-omit-frame-pointer -g -std=gnu++17

  • stb_image in CLI project throws linker errors

    stb_image in CLI project throws linker errors

    Describe the bug stb_image in CLI project throws linker errors 2019, 1120

    To Reproduce Steps to reproduce the behavior: Add to CLI project, watch it fail with liker errors

    Expected behavior most, if not all functionality supported

    Screenshots N/A

  • stb_image: Fix gif two_back memory address

    stb_image: Fix gif two_back memory address

    Hi, this should be a simple fix: since out is always the starting address, two_back should be calculated as follows,

    if (layers >= 2) {
        two_back = out + ((layers - 2) * stride);
    }
    

    otherwise, it would cause a segmentation fault.

    Testing image test_alpha.gif.zip

  • stb_image: Fix

    stb_image: Fix "unused invalid_chunk" with STBI_FAILURE_USERMSG

    If STBI_FAILURE_USERMSG is set, GCC warns:

    stb_image.h:5183:28: warning: variable ‘invalid_chunk’ set but not used [-Wunused-but-set-variable]
        static char invalid_chunk[] = "XXXX PNG chunk not known";
    

    Add STBI_FAILURE_USERMSG to the ifndef condition that disables the section (along with STBI_NO_FAILURE_STRINGS).


    Note: I don't need (and weakly don't want) to be added to the contributor's list. I don't care about attribution.

Abseil Common Libraries (C++)

Abseil - C++ Common Libraries The repository contains the Abseil C++ library code. Abseil is an open-source collection of C++ code (compliant to C++11

Nov 23, 2022
Basic Development Environment - a set of foundational C++ libraries used at Bloomberg.

BDE Libraries This repository contains the BDE libraries, currently BSL (Basic Standard Library), BDL (Basic Development Library), BAL (Basic Applicat

Nov 24, 2022
C++14 evented IO libraries for high performance networking and media based applications

LibSourcey C++ Networking Evolved LibSourcey is a collection of cross platform C++14 modules and classes that provide developers with an arsenal for r

Nov 22, 2022
stb single-file public domain libraries for C/C++

stb single-file public domain (or MIT licensed) libraries for C/C++ Noteworthy: image loader: stb_image.h image writer: stb_image_write.h image resize

Nov 28, 2022
Single header lib for JPEG encoding. Public domain. C99. stb style.

tiny_jpeg.h A header-only public domain implementation of Baseline JPEG compression. Features: stb-style header only library. Does not do dynamic allo

Nov 22, 2022
Single header lib for JPEG encoding. Public domain. C99. stb style.

tiny_jpeg.h A header-only public domain implementation of Baseline JPEG compression. Features: stb-style header only library. Does not do dynamic allo

Nov 22, 2022
Several single-file, cross-platform, public domain libraries for C/C++ that I use for learning / testing

HTC Several single-file, cross-platform, public domain libraries for C/C++ that I use for learning / testing (Not meant for production code). This is

Nov 5, 2022
A single file, public domain C implementation of aSchroeder reverb.

Introduction This is a reverb implementation based on Freeverb, a public domain reverb written by Jezar at Dreampoint in 2000. The library is written

Nov 1, 2022
Single file public domain networking library

zed_net zed_net is a single file, public domain library that provides a simple wrapper around BSD sockets (Winsock 2.2 on Windows), intended primary f

Jul 18, 2022
A collection of public domain/unlicense single-file cryptography

simple-crypto A collection of single-file public domain/unlicense cryptographic functions in different programming languages. Feel free to copy-paste

Sep 24, 2022
linalg.h is a single header, public domain, short vector math library for C++

linalg.h linalg.h is a single header, public domain, short vector math library for C++. It is inspired by the syntax of popular shading and compute la

Nov 24, 2022
The MHS Filesystem- A very simple linked-list based file system designed for recoverability and low data redundancy. Public domain filesystem (Version 1)

MHS Filesystem The MHS filesystem. Features: can be modified to work with any size of disk or sector, even non powers of two! Allocation bitmap stored

Sep 17, 2022
Public domain, header-only file to simplify the C programmer's life in their interaction with strings

SCL_String Public domain, header-only file to simplify the C programmer's life in their interaction with strings NOTE: This library is still under con

Aug 22, 2022
Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C
Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

rpmalloc - General Purpose Memory Allocator This library provides a public domain cross platform lock free thread caching 16-byte aligned memory alloc

Nov 22, 2022
Jittey - A public domain text editor written in C and Win32
Jittey  - A public domain text editor written in C and Win32

Jittey (Jacob's Terrific Text Editor) is a single-file basic text editor written in pure C and Win32, there is no real reason to use it, but it

Sep 28, 2022
⛳ Simple, extensible, header-only C++17 argument parser released into the public domain.

⛳ flags Simple, extensible, header-only C++17 argument parser released into the public domain. why requirements api get get (with default value) posit

Oct 25, 2022
Rpmalloc - Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C
Rpmalloc - Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

rpmalloc - General Purpose Memory Allocator This library provides a public domain cross platform lock free thread caching 16-byte aligned memory alloc

Nov 22, 2022
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain

This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output.

Dec 1, 2022
super duper simple gui for C, wrapping imgui and stb

super duper simle gui for C, wrapping imgui and stb You can use it as a static library with cmake. See the example directory for a complete example. E

May 19, 2022
A collection of single-file C libraries. (generic containers, random number generation, argument parsing and other functionalities)

cauldron A collection of single-file C libraries and tools with the goal to be portable and modifiable. Libraries library description arena-allocator.

Oct 26, 2022