Skip to content

Instantly share code, notes, and snippets.

View dacanizares's full-sized avatar

Daniel Cañizares Corrales dacanizares

View GitHub Profile
// Rounds up to the next nearest power-of-two value
static inline unsigned int pow2_ceil( unsigned int x ) {
#if defined( __clang__ ) || defined( __GNUC__ )
return 1 + ( ( x >= 2 ) * ( ( ( 1u << 31 ) >> ( __builtin_clz( ( x - 1 ) | 1 ) - 1 ) ) - 1 ) );
#elif defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_X64 ) )
return ( 1u << 31 ) >> ( __lzcnt( ( x - 1 ) | ( x == 0 ) ) - 1 );
#elif defined( _MSC_VER ) && ( defined( _M_ARM ) || defined( _M_ARM64 ) )
return ( 1u << 31 ) >> ( __clz( ( x - 1 ) | ( x == 0 ) ) - 1 );
#else
--x; // if x is already pow2, we don't want the next pow2

Announcement

Please stop using this extension and Microsoft's C++ extension for Unreal code completion.

clangd

The VSCode extension clangd has blazing fast code completion in comparison. I've made a VSCode extension for it:

https://github.com/boocs/unreal-clangd

You will use clangd for code completion(Intellisense) and use Microsoft's C++ extension for Building/Debugging

@ruccho
ruccho / Generate Normal Map.lua
Last active November 18, 2025 06:54
The enhanced version of this script is available: https://gist.github.com/ruccho/2d1eb4aea3dfa55690c2ddc4419172ff
----------------------------------------------------------------------
-- Generate Normal Map
--
-- It works only for RGB color mode.
----------------------------------------------------------------------
if app.apiVersion < 1 then
return app.alert("This script requires Aseprite v1.2.10-beta3")
end
@cyaoeu
cyaoeu / ue4.xml
Last active November 27, 2018 01:41
Blender UE4 theme (WIP) - install using Install Theme from user preferences
<bpy>
<Theme>
<user_interface>
<ThemeUserInterface menu_shadow_fac="0.5"
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
widget_emboss="#31313105"
axis_x="#dc0000"
axis_y="#00dc00"