This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void fun() | |
{ | |
union Test1 | |
{ | |
struct | |
{ | |
u32 foo : 2; | |
u32 bar : 2; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*--------------------------------------------------------------------------------- | |
nehe lesson 2 port to GX by WinterMute | |
---------------------------------------------------------------------------------*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <malloc.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <string> | |
#include <GLES2/gl2.h> | |
#include <tr1/memory> | |
#include <ppapi/cpp/instance.h> | |
#include <ppapi/cpp/module.h> | |
#include <ppapi/cpp/var.h> | |
#include <ppapi/gles2/gl2ext_ppapi.h> | |
#include <ppapi/c/ppb_opengles.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>NaCl Test</title> | |
<script type="text/javascript"> | |
ApplicationModule = null; // Global application object. | |
statusText = 'NO-STATUS'; | |
// Indicate load success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int* findIntSSE2(const int* __restrict begin, const int* __restrict end, int needle) | |
{ | |
const int* it = begin; | |
unsigned long index; | |
__m128i n = _mm_set1_epi32(needle); | |
while (it != end) | |
{ | |
__m128i x = _mm_load_si128(reinterpret_cast<const __m128i*>(it)); | |
__m128i m = _mm_cmpeq_epi32(x, n); | |
unsigned long k = _mm_movemask_epi8(m); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct FloatBits | |
{ | |
u32 mantissa : 23; | |
u32 exponent : 8; | |
u32 sign : 1; | |
}; | |
template <typename ResultT, typename InputT> | |
inline ResultT bitCast(InputT v) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool calculate_best_fit_plane(const Vec3* points, u32 count, Vec3& out_center, Vec3& out_normal) | |
{ | |
if (count < 3) | |
{ | |
return false; | |
} | |
Vec3 center = Vec3(0.0f); | |
for (u32 i = 0; i < count; ++i) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NOMINMAX | |
#define _CRT_SECURE_NO_WARNINGS | |
#include <stdio.h> | |
#include <windows.h> | |
#include <stdint.h> | |
#include <math.h> | |
#include <float.h> | |
#include <algorithm> | |
#include <vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -o cachebench -O2 -std=c++14 cachebench.cpp | |
#include <stdio.h> | |
#include <chrono> | |
#include <vector> | |
#include <algorithm> | |
#include <random> | |
#include <float.h> | |
#include <stdint.h> | |
#include <cstring> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iPhone X | |
sizeLog2: 10 - Data size: 1 KiB (16 cache lines) - Total time: 0.096518 sec - Time/elem: 2.876475 ns - | |
sizeLog2: 11 - Data size: 2 KiB (32 cache lines) - Total time: 0.098588 sec - Time/elem: 2.938146 ns - | |
sizeLog2: 12 - Data size: 4 KiB (64 cache lines) - Total time: 0.098571 sec - Time/elem: 2.937641 ns - | |
sizeLog2: 13 - Data size: 8 KiB (128 cache lines) - Total time: 0.098576 sec - Time/elem: 2.937794 ns - | |
sizeLog2: 14 - Data size: 16 KiB (256 cache lines) - Total time: 0.098489 sec - Time/elem: 2.935203 ns - | |
sizeLog2: 15 - Data size: 32 KiB (512 cache lines) - Total time: 0.098492 sec - Time/elem: 2.935303 ns - | |
sizeLog2: 16 - Data size: 64 KiB (1024 cache lines) - Total time: 0.098705 sec - Time/elem: 2.941644 ns - | |
sizeLog2: 17 - Data size: 128 KiB (2048 cache lines) - Total time: 0.293225 sec - Time/elem: 8.738775 ns - | |
sizeLog2: 18 - Data size: 256 KiB (4096 cache lines) - Total time: 0.324969 sec - Time/elem: 9.684835 ns - |