diff --git a/bitmap/buid.sh b/bitmap/buid.sh new file mode 100644 index 0000000..e2164d8 --- /dev/null +++ b/bitmap/buid.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc -o main main.c +./main \ No newline at end of file diff --git a/bitmap/build.bat b/bitmap/build.bat new file mode 100644 index 0000000..4558362 --- /dev/null +++ b/bitmap/build.bat @@ -0,0 +1 @@ +../vcbuild.bat main \ No newline at end of file diff --git a/bitmap/main.c b/bitmap/main.c index 3aea3b2..9303db1 100644 --- a/bitmap/main.c +++ b/bitmap/main.c @@ -1,12 +1,14 @@ #include /* for uint32_t */ -#include +#include +#include int main() { unsigned int i = 0; + unsigned int x; i |= 1 << 3; // or i |= 0x8; or i |= 8 - for(unsigned int x = 0; x < 32; x++) // unsigned int = 32bits per ILP32 + for(x = 0; x < 32; x++) // unsigned int = 32bits per ILP32 if ((i & (1 << x)) == i) - cout << x << endl; + printf("%i\n", x); return 0; } \ No newline at end of file diff --git a/vcbuild.bat b/vcbuild.bat new file mode 100644 index 0000000..25ea55e --- /dev/null +++ b/vcbuild.bat @@ -0,0 +1,19 @@ +@setlocal enableextensions enabledelayedexpansion +@echo off +if exist "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 + goto compile +) +if exist "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 + goto compile +) +if exist "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 + goto compile +) +:compile +cl.exe %1.c > nul +%1.exe +del %1.obj +pause \ No newline at end of file diff --git a/vcppbuild.bat b/vcppbuild.bat new file mode 100644 index 0000000..93a9d9f --- /dev/null +++ b/vcppbuild.bat @@ -0,0 +1,19 @@ +@setlocal enableextensions enabledelayedexpansion +@echo off +if exist "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 + goto compile +) +if exist "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 + goto compile +) +if exist "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" ( + call "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 + goto compile +) +:compile +cl.exe /clr %1.cpp > nul +%1.exe +del %1.obj +pause \ No newline at end of file