PENTAX Optio S5n 3월중 출시

가지고 있는 카메라 Optio S5i의 후속작인 S5n이 3월중 출시된단다.

일단 가장 큰 변화로는 액정 LCD의 사이즈가 1.8인치에서 2.0인치로 늘어난다는것. 대신 뷰파인더는 사라졌다.

그리고 320×200 해상도로 초당 15프레임으로 촬영할 수 있었던 동영상이 620×400 해상도로 초당 30프레임으로 촬영가능으로 대폭 강화되었다.

그 외의 모든 스펙은 동일한 것 같고 디지털 필터 쪽이 추가되는등의 자잘한 기능 보완이 있는 듯 하다.

캐논의 익시 시리즈와 거의 비슷한 스펙을 가지고 있고 가격도 저렴한데도 불구하고 한국에서는 별로 인기가 없는 듯 해서 다소 아쉽지만, 꾸준히 개선 시키면서 업그레이드 모델을 내 놓는 통에 애착이 간다.

다음 링크에서 자세한 내용을 확인 가능하다.

PENTAX Optio S5n

Use Bit Flags

I have seen many programmers use dozens of chart-sized variables or Booleans to store simple on or off flags. This is a tremendous waste of space, as you only need a single bit to represent the true or false value of a flag. Instead, I like to use a lot of bit flags. Here is a hypothetical example:

We have a sprite structure for our game. This structure needs to keep track of whether the sprite is invisible and if the sprite can be collided against. If you were to have one member per flag, your structure might look like this:

typdef struct sprite_s
{
.
.
.
char nHidden
char nCollide
.
.
.

} sprite_t;
Sure, you are pretty crafty using bytes instead of whole integers to store this flag. But if you use bit flags, you can reduce this by half:

#define BITFLAG_HIDDEN 0x01
#define BITFLAG_COLLIDE 0x02

typdef struct sprite_s
{
.
.
.
unsigned char nFlags
.
.
.
} sprite_t;
Now we only need a single character, nFlags, to hold both flags. A byte is 8 bits. We use two of these to represent the hidden and collision states. For instance, if we want to set the hidden bit, simply OR in the bit flag defined up top:

nFlags |= BITFLAG_HIDDEN;

Now, the first bit is turned on. If we want to turn this bit on, we AND the flags with the inverse of the bit flag that we wish to remove:

nFlags &= ~BITFLAG_HIDDEN;
The first bit is now cleared. The great thing is that we can combine the flags like this:

nFlags |= (BITFLAG_HIDDEN | BITFLAG_COLLISION);
To determine if a bit flag is turned on, use the bitwise AND operation:

if (nFlags & BITFLAG_HIDDEN)
return;
In this case, bail out of the function if the sprite is not visible. This code fragment would be something that you may see in a sprite drawing loop.

Of course, we have only defined two bit flags. A byte can hold 8. If you need more, you can use a short for 16 bits or an integer for 32 bits. Make sure you define the flags field as unsigned. Otherwise, you will have issues reading the values in the debugger when you turn on the sign bit.