Computer Store
store.prestwood.com
-Collapse +Expand
alvitar
Phil Harbison
Parent Co: alvitar
-Collapse +Expand Profile
Member Info
Member Narration

POSTS:
MB Posts (2)
KB Comments (3)◄╣

Search alvitar:

Advanced

   ► KB ►  Print This     

Latest KB Comments: alvitar

Ordered newest to oldest.

Showing only alvitar posts.  To view comments to your KB Articles, go to your My Knowledge Base page. To view user contributions to your blogs, go to your My Blog page.

Read +Add Comment
The logical operators '&' and '~' (bitwise 'and' and 'not') can be useful in rounding numbers. Suppose I have a variable x and I want to round it up to a multiple of 4. This code will do that.     x = (x + 3) & ~3; Rounding down to a multiple of 4 is even easier.     x = x & ~3; This only works for rounding to a power of 2, however, that is a common requirement and this code is much more efficient for rounding to a power of 2 than using the modulo operator and division.
Posted 11 years ago
Regarding...
Java Logical Operators
{Too Long!}
Read +Add Comment
{Too Long!}
Posted 11 years ago
Regarding...
C++ If Statement (if..else if..else)

C++ If Statement

Same as standard C.
Read +Add Comment
I usually inline all simple accessor (get/set) methods in C++. If you are concerned about performance, this is a much better approach than making members (instance variables) public. By inlining an accessor, you get the performance of direct access to public members but retain the benefits of encapsulation. Should your simple accessor method grow in complexity, you can easily change your strategy in one place rather than having to find and modify every reference to a public member.
Posted 11 years ago
Regarding...
C++ Inlining (inline)
{Too Long!}


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech