online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <assert.h> /** * @param s - Signal to match the filter, any value * @param f - The filter itself, 0 or 1 * @returns s if f == 1, 0 otherwise */ signed int filter(signed int s, unsigned char f) { assert(sizeof(s) == 4); assert(0 <= f <= 1); signed int A = f * 0x80000000; unsigned char B = f; signed char C = s >> 31; signed int D = s & 0x7FFFFFFF; signed int x = A, y = (A+B+C == 0x80000000) ? (A+B+C) : 0, z = (A+D < 0) ? (A+D) : 0; signed int res = x+y+z; printf("==============\n"); printf("filter(%i, %d):\n", s, f); printf("> A = %d * 0x80000000 // == %i\n", f, A); printf("> B = %d\n", B); printf("> C = %i >> 31 // == %d\n", s, C); printf("> D = %i & 0x7FFFFFFF // == %i\n", s, D); printf(">> x = %i\n", x); printf(">> y = %i\n", y); printf(">> z = %i\n", z); printf(">>> res = %i\n", res); printf("filter(%i, %d) == %i\n", s, f, res); printf("==============\n"); printf("\n"); return res; } int main() { filter(42, 0); filter(42, 1); filter(-625, 0); filter(-625, 1); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue