This file contains 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
/** | |
* \brief Outputs an ASCII string that will be visible in a debugger. | |
* \note Uses OutputDebugStringA on Windows. Prints to stderr on all other platforms. | |
*/ | |
extern DECLSPEC void SDLCALL SDL_DebugOutput(const char *str); | |
void SDL_DebugOutput(const char *str) | |
{ | |
#if defined(__WIN32__) || defined(__WINRT__) | |
OutputDebugStringA(str); |
This file contains 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 <SDL.h> | |
#include <SDL_opengl.h> | |
#include <stdio.h> | |
#include <string> | |
// PER_BEGIN | |
#define SDL_OPENGL_LOAD_IMPLEMENT | |
#include "SDL_opengl_load.h" | |
// PER_END |
This file contains 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
#ifndef _SDL_stb_h | |
#define _SDL_stb_h | |
// Memory buffers | |
typedef struct | |
{ | |
Uint8 *data; | |
Uint32 size; | |
} SDL_MemoryBuffer; |
This file contains 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
In new(p) T(x) the C++ standard requires that placement new performs a null pointer check on p. | |
Unfortunately, this can add a pointless conditional to inner loops that use dynamic arrays implemented | |
in C++ via placement new. I don't expect the optimizer to perform a global analysis to conclude that p | |
can never be null, so I have to help it on its way. However, none of these three tricks convince Clang 3.5: | |
new(&*p) T(x); | |
(void) *p; | |
new(p) T(x); |
This file contains 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
template<class U> | |
constexpr U static_pow(U base, U exponent) | |
{ | |
return exponent == U(0) ? U(1) : base * static_pow(base, exponent - 1); | |
} | |
template<size_t N, size_t I, class U> | |
U radix_put(U w, U x) | |
{ | |
constexpr U M = static_pow(N, I), MN = M * N; |
This file contains 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
// |
This file contains 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
(require 'cl) | |
(require 'timer) | |
(defvar emacscast-events nil) | |
(defvar emacscast-recording-p nil) | |
(defvar emacscast-replay-events nil) | |
(defvar emacscast-replay-time nil) | |
(defun emacscast-forget-last-command () | |
(when emacscast-recording-p |
This file contains 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
(defun dbg-watch (expression) | |
(interactive "sExpression: ") | |
(dbg-mi-command (list 'dbg-watch-handler expression) "-var-create - @ %s" (prin1-to-string expression))) | |
(defun dbg-watch-handler (status result expression) | |
(case status | |
((done) | |
(push (cons (cons 'expression expression) result) dbg-watches))) | |
(dbg-render-watches)) |
This file contains 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
(defcustom autoeval-default-interval 1 "") | |
(defvar autoeval-sexps nil) | |
(defvar autoeval-interval autoeval-default-interval) | |
(defmacro autoeval (form) | |
`(progn | |
(push ',form autoeval-sexps) | |
(autoeval-start autoeval-interval))) |
This file contains 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
(require 'cl) | |
(defvar inspector-id 0) | |
(defvar inspector-keymap | |
(let ((keymap (make-sparse-keymap))) | |
(define-key keymap (kbd "<tab>") | |
(lambda () | |
(interactive) | |
(save-excursion |