Typo fixes

This commit is contained in:
Ginger Bill 2015-11-18 09:53:00 +00:00
parent c01deefae5
commit ef2665e8bd
7 changed files with 12 additions and 125 deletions

2
.gitignore vendored
View File

@ -222,3 +222,5 @@ _Pvt_Extensions
misc/
*.sublime*
test.*
src
*.sln

View File

@ -5,8 +5,8 @@ gb single-file public domain libraries for C & C++
library | latest version | category | languages | description
----------------|----------------|----------|-----------|-------------
**gb_string.h** | 0.93 | strings | C, C++ | A better string library for C & C++
**gb.hpp** | 0.21 | misc | C++11 | (Experimental) A C++11 helper library without STL geared towards game development
**gb_math.hpp** | 0.02 | math | C++11 | A C++11 math library geared towards game development
**gb.hpp** | 0.21b | misc | C++11 | (Experimental) A C++11 helper library without STL geared towards game development
**gb_math.hpp** | 0.02b | math | C++11 | A C++11 math library geared towards game development
**gb_ini.h** | 0.91 | misc | C, C++ | A simple ini file loader library for C & C++
## FAQ

7
gb.hpp
View File

@ -1,8 +1,9 @@
// gb.hpp - v0.21a - public domain C++11 helper library - no warranty implied; use at your own risk
// gb.hpp - v0.21b - public domain C++11 helper library - no warranty implied; use at your own risk
// (Experimental) A C++11 helper library without STL geared towards game development
/*
Version History:
0.21b - Typo fixes
0.21a - Better `static` keywords
0.21 - Separate Math Library
0.20a - #ifndef for many macros
@ -38,7 +39,7 @@ WARNING
- This also means that many functions are not documented.
- This library is not compatible with STL at all! (By design)
Context:
CONTENTS:
- Common Macros
- Assert
- Types
@ -373,7 +374,7 @@ __GB_NAMESPACE_START
// NOTE(bill): (std::)size_t is not used not because it's a bad concept but on
// the platforms that I will be using:
// sizeof(size_t) == sizeof(usize) == sizeof(s64)
// sizeof(size_t) == sizeof(usize) == sizeof(ssize)
// NOTE(bill): This also allows for a signed version of size_t which is similar
// to ptrdiff_t
// NOTE(bill): If (u)intptr is a better fit, please use that.

29
gb.sln
View File

@ -1,29 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}") = "gb", "bin\gb.exe", "{5548FA62-E3AA-4E84-85B2-4CF1D02FE804}"
ProjectSection(DebuggerProjectSystem) = preProject
PortSupplier = 00000000-0000-0000-0000-000000000000
Executable = W:\gb\bin\gb.exe
RemoteMachine = BILL-PC
StartingDirectory = W:\gb
Environment = Default
LaunchingEngine = 00000000-0000-0000-0000-000000000000
UseLegacyDebugEngines = No
LaunchSQLEngine = No
AttachLaunchAction = No
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5548FA62-E3AA-4E84-85B2-4CF1D02FE804}.Debug|x64.ActiveCfg = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,9 +1,10 @@
// gb_math.hpp - v0.02a - public domain C++11 math library - no warranty implied; use at your own risk
// gb_math.hpp - v0.02b - public domain C++11 math library - no warranty implied; use at your own risk
// A C++11 math library geared towards game development
// This is meant to be used the gb.hpp library but it doesn't have to be
/*
Version History:
0.02b - Typo fixes
0.02a - Better `static` keywords
0.02 - More Angle Units and templated min/max/clamp/lerp
0.01 - Initial Version
@ -18,7 +19,7 @@ WARNING
- This also means that many functions are not documented.
- This library was developed in conjunction with `gb.hpp`
Context:
CONTENTS:
- Common Macros
- Assert
- Types
@ -312,7 +313,7 @@ __GB_NAMESPACE_START
// NOTE(bill): (std::)size_t is not used not because it's a bad concept but on
// the platforms that I will be using:
// sizeof(size_t) == sizeof(usize) == sizeof(s64)
// sizeof(size_t) == sizeof(usize) == sizeof(ssize)
// NOTE(bill): This also allows for a signed version of size_t which is similar
// to ptrdiff_t
// NOTE(bill): If (u)intptr is a better fit, please use that.

View File

@ -1,83 +0,0 @@
#include "../gb.hpp"
global gb::Heap_Allocator g_heap = {};
inline gb::Allocator*
default_allocator()
{
return &g_heap;
}
int main(int argc, char** argv)
{
// "Use" variables
argc; argv;
using namespace gb;
{
const u8 bytes[4] = {0x00, 0x20, 0xa7, 0x44};
f32 a = reinterpret_cast<const f32&>(bytes);
printf("%f\n", a);
const f32 f = 1337.0f;
u8* fb = (u8*)(&f);
printf("0x%x%x%x%x\n", fb[0], fb[1], fb[2], fb[3]);
}
{
auto table = hash_table::make<f32>(default_allocator());
hash_table::set(&table, 123, 321.0f);
hash_table::set(&table, 456, 654.0f);
#define PGET(key, d) printf("%7d : %7f \n", key, hash_table::get(table, (key), (f32)(d)))
PGET(123, 0);
PGET(456, 0);
PGET(789, 0);
#undef PGET
}
{
String hello = string::make(default_allocator(), "Hello");
String world = string::make(default_allocator(), ", world!", 8);
defer(string::free(hello));
defer(string::free(world));
string::append(&hello, world);
printf("%s\n", hello);
}
for (u32 i = 0; i < 8; i++)
{
u64 bins[10] = {};
auto gen_rand = random::make_random_device();
auto gen = random::make_mt19937_64(random::next(&gen_rand));
for (usize i = 0; i < 200000; i++)
{
u64 result = random::uniform_u64_distribution(&gen, 0, 9);
bins[result]++;
}
for (usize i = 0; i < 10; i++)
{
printf("%2d : ", i);;
u32 a = (u32)(bins[i] / 1000);
for (u32 i = 0; i < a; i++)
printf("*");
printf("\n");
}
time::sleep(time::seconds(1));
}
while (getchar() != '\n')
;
return 0;
}

View File

@ -1,5 +0,0 @@
#include "main.cpp"
#define GB_IMPLEMENTATION
#include "../gb.hpp"