<commit_before>CxxSwizzle
==========

2015.02.17 Update: The library now comes with SIMD support. More info soon.

CxxSwizzle (a reality-friendly way of writing down "C++ Swizzle") is a header-only, dependency free extensible library bringing shader languages' (GLSL, HSLS) vector "swizzle" syntax into C++. Basically, you can do this in C++ now:

    vec4 foo(0);                        // 0,0,0,0
    foo.yx = vec2(2, 1);                // 1,2,0,0
    foo.zw = foo.xy * 2;                // 1,2,2,4
    vec2 bar = max(foo.xw, foo.yz).yx;  // 4,2
    bar = clamp(foo.xw, 0, 2);          // 1,2  
    mat2 m(foo.xyz, 1);                 // 1,2,2,1
    bar *= m;                           // 5,2
    // etc.

What's the use? Familiar and easy to use syntax for non-critical pieces of code. Also, given GLSL/HLSL similarity to C you can execute most shaders directly as C++ code, with just a little help from the preprocessor (keyword substitution). That gives debugging and flexibility capabilities unpararelled by existing shader debugging solutions - you can use IDE of your choice, add logging, assertions, breakpoints (even conditional ones!), unit tests for functions etc.

The following snippet will compile both in C++ and GLSL.

    #ifdef __cplusplus
    #include <cassert><commit_msg>fixed typo in README.md(HSLS->HLSL)<commit_after>CxxSwizzle
==========

2015.02.17 Update: The library now comes with SIMD support. More info soon.

CxxSwizzle (a reality-friendly way of writing down "C++ Swizzle") is a header-only, dependency free extensible library bringing shader languages' (GLSL, HLSL) vector "swizzle" syntax into C++. Basically, you can do this in C++ now:

    vec4 foo(0);                        // 0,0,0,0
    foo.yx = vec2(2, 1);                // 1,2,0,0
    foo.zw = foo.xy * 2;                // 1,2,2,4
    vec2 bar = max(foo.xw, foo.yz).yx;  // 4,2
    bar = clamp(foo.xw, 0, 2);          // 1,2  
    mat2 m(foo.xyz, 1);                 // 1,2,2,1
    bar *= m;                           // 5,2
    // etc.

What's the use? Familiar and easy to use syntax for non-critical pieces of code. Also, given GLSL/HLSL similarity to C you can execute most shaders directly as C++ code, with just a little help from the preprocessor (keyword substitution). That gives debugging and flexibility capabilities unpararelled by existing shader debugging solutions - you can use IDE of your choice, add logging, assertions, breakpoints (even conditional ones!), unit tests for functions etc.

The following snippet will compile both in C++ and GLSL.

    #ifdef __cplusplus
    #include <cassert>
{'fraction_non_alphanumeric': 0.10697852760736197, 'fraction_numerical': 0.03144171779141104, 'mean_word_length': 2.5256756756756755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2574089', 'n_tokens_mistral': 861, 'n_tokens_neox': 772, 'n_words': 322}