background preloader

Programming

Facebook Twitter

Intro / Home Page. Low Level Bit Hacks You Absolutely Must Know. I decided to write an article about a thing that is second nature to embedded systems programmers - low level bit hacks.

Low Level Bit Hacks You Absolutely Must Know

Bit hacks are ingenious little programming tricks that manipulate integers in a smart and efficient manner. Instead of performing some operation (such as counting the 1 bits in an integer) by looping over individual bits, these programming nuggets do the same with one or two carefully chosen bitwise operations. To get things going I'll assume that you know what the two's complement binary representation of an integer is and also that you know all the the bitwise operations.

I'll use the following notation for bitwise operations in the article: The Art of Assembly Language Programming. Stanford CS Ed Library. Pointer Basics. This document introduces the basics of pointers as they work in several computer languages -- C, C++, Java, and Pascal.

Pointer Basics

This document is the companion document for the Pointer Fun with Binky digital video, or it may be used by itself. This is document 106 in the Stanford CS Education Library. This and other free materials are available at cslibrary.stanford.edu. Some documents that are related to this one include... Section 1 -- Pointer Rules One of the nice things about pointers is that the rules which govern how they work are pretty simple. 1) Pointers and Pointees A pointer stores a reference to something. The above drawing shows a pointer named x pointing to a pointee which is storing the value 42. Allocating a pointer and allocating a pointee for it to point to are two separate steps. 2) Dereferencing The dereference operation starts at the pointer and follows its arrow over to access its pointee. 3) Pointer Assignment Below are versions of this example in C, Java, C++, and Pascal. C++ Programming/Exercises/Iterations - Wikibooks, open books for an open world - StumbleUpon.

Iterations[edit] Solutions requirements Solutions must: Use only standard C++.Be compilable.Be in accordance to general coding practices.

C++ Programming/Exercises/Iterations - Wikibooks, open books for an open world - StumbleUpon

Free Web Development Tools for Windows. Create a web page - StumbleUpon. C++ QUICK REFERENCE. Matt Mahoney, mmahoney@cs.fit.edu // Comment to end of line /* Multi-line comment */ #include <stdio.h> // Insert standard header file #include "myfile.h" // Insert file in current directory #define X some text // Replace X with some text #define F(a,b) a+b // Replace F(1,2) with 1+2 #define X \ some text // Line continuation #undef X // Remove definition #if defined(X) // Condional compilation (#ifdef X) #else // Optional (#ifndef X or #if !

C++ QUICK REFERENCE

Defined(X)) #endif // Required after #if, #ifdef 255, 0377, 0xff // Integers (decimal, octal, hex) 2147483647L, 0x7fffffffl // Long (32-bit) integers 123.0, 1.23e2 // double (real) numbers 'a', '\141', '\x61' // Character (literal, octal, hex) '\n', '\\', '\'', '\"' // Newline, backslash, single quote, double quote "string\n" // Array of characters ending with newline and \0 "hello" "world" // Concatenated strings true, false // bool constants 1 and 0 Function parameters and return values may be of any type.

STDIO.H, CSTDIO (Input/output) Learning Modern 3D Graphics Programming - StumbleUpon. PHP Tutorial for Beginners. How C Programming Works&. The previous discussion becomes a little clearer if you understand how memory addresses work in a computer's hardware.

How C Programming Works&

If you have not read it already, now would be a good time to read How Bits and Bytes Work to fully understand bits, bytes and words. All computers have memory, also known as RAM (random access memory). For example, your computer might have 16 or 32 or 64 megabytes of RAM installed right now. RAM holds the programs that your computer is currently running along with the data they are currently manipulating (their variables and data structures). Memory can be thought of simply as an array of bytes. Float f; This statement says, "Declare a location named f that can hold one floating point value.

" While you think of the variable f, the computer thinks of a specific address in memory (for example, 248,440). F = 3.14; The compiler might translate that into, "Load the value 3.14 into memory location 248,440. " The output that you see from the program will probably look like this: Educational programming language - StumbleUpon. From Seo Wiki - Search Engine Optimization and Programming Languages An educational programming language is a programming language that is designed primarily as a learning instrument and not so much as a tool for writing real-world application programs. Learning Paths Many educational programming languages position themselves inside a learning path, that is a sequence of languages each designed to build on the others moving a student from easy to understand and entertaining environments to full professional environments.

Some of the better known are presented below. Smalltalk/Squeak based Java based Sun's recommended path is Greenfoot to BlueJ to Netbeans/BlueJ to Netbeans/Java[5] Programmed Introduction to MIPS Assembly Language - StumbleUpon. This is a course in assembly language programming of the MIPS processor.

Programmed Introduction to MIPS Assembly Language - StumbleUpon

It emphasizes the topics needed for study of computer architecture: bits, bit patterns, operations on bit patterns, and how bit patterns represent instructions and data. This course is equivalent to a semester-long junior college or university course (except, perhaps, for the emphasis on bit patterns). The emphasis of the course is on understanding how computers work.

This will provide a basis for further study of computer architecture and computer software. The MIPS processor, the subject of this course, has a well designed architecture and is particularly fruitful to study. Beginning Gaming Educator's Toolkit. C# Prog-lang.