Advertisement
DEKTEN

MODNOMOD

Apr 21st, 2021
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.11 KB | None | 0 0
  1. //: twitch: www.twitch.com/kanjicoder
  2. //: test rig for "modulus-without-modulus" code snippet for GLSL shader code.
  3. #include <stdio.h> //:for: printf(...)
  4. #include <math.h>  //:for: floor(....)
  5.  
  6. int main( void ){
  7.     printf("[BEG:main]\n");
  8.     #define F_L_O_O_R floor
  9.    
  10.     float MODDED_VALUE;
  11.     float F32_BAS_001 =( 7 );
  12.     float F32_DIV_002 =( 3 );
  13.  
  14.     //:                                F32_BAS_001 == 7
  15.     //:                                     |
  16.     //:                                     V
  17.     //:[ 0 ][ 1 ][ 2 ][ 3 ][ 4 ][ 5 ][ 6 ][ 7 ]
  18.     //:[             ][             ][             ]
  19.     //:[ 0 ][ 1 ][ 2 ][ 0 ][ 1 ][ 2 ][ 0 ][ 1 ][ 2 ]
  20.     //:                                     ^
  21.     //:                                     |
  22.     //:                               MODDED_VALUE == 1
  23.    
  24.         MODDED_VALUE=(  //:@_SC_MOD_WITHOUT_MOD_@://
  25.                     (F32_BAS_001)-
  26.         (F_L_O_O_R( (F32_BAS_001)/F32_DIV_002 )
  27.                                  *F32_DIV_002 ));;
  28.    
  29.     printf("[MODDED_VALUE]:%f\n" , MODDED_VALUE );
  30.    
  31.  
  32.     #undef F_L_O_O_R
  33.     printf("[END:main]\n");
  34. }  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement