Friday, June 11, 2010
Another video of my DVD Menu of wedding. This is actually the sixth of my video posts with the same subject but my other posts failed. I don’t know why and I didn’t even know it did. And unfortunately, I’ve already deleted those videos.
Why I’m posting these stuffs here? Well, I have another reason of doing this so--storage :).
This video features the picture-in-picture effects. I created the background video in Adobe Premiere and did the text works and other stuffs in Adobe Photoshop. Hope you liked though I’m still a struggling video editor & designer.
Wednesday, June 2, 2010
This is a wrapper class in manipulating bits in C/C++. This
wrapper accepts up to 64 bits of data.
#ifndef _bits_h_
#define _bits_h_
struct XBits
{
#endif //_bits_h_
#define _bits_h_
struct XBits
{
int bitSize;
__int64 *lBitData;
template<typename> _bittype>XBits(_bittype *bt)
{
BOOL check(int pos)
{
void set(int pos, BOOL fSet)
{
void xor(int pos)
{
};__int64 *lBitData;
template<typename> _bittype>XBits(_bittype *bt)
{
bitSize = 8 * sizeof(_bittype);
lBitData = (__int64*)bt;
}lBitData = (__int64*)bt;
BOOL check(int pos)
{
return (((*lBitData) >> pos) & 1)==1;
}void set(int pos, BOOL fSet)
{
__int64 lData = *lBitData;
if( fSet )
}if( fSet )
lData |= 1 << pos;
elselData &= ~(1 << pos);
*lBitData = lData;void xor(int pos)
{
__int64 lData = *lBitData;
lData ^= 1 << pos;
*lBitData = lData;
}lData ^= 1 << pos;
*lBitData = lData;
#endif //_bits_h_
Sample instantiation:
int main(int argc, char* argv[]) { BYTE bdata = 0; XBits bits(&bdata); bits.set(5, 1); bits.xor(4); | // Set bit 5 to 1 // Toggle bit number 4. Turn to 0 // if it‘s 1 & vice-versa |
if( bits.check(1) ) }{ // some code here }else { // some code here } | // Checks if bit number 1 is on or off |
Labels:
bits,
c,
c++,
code,
manipulation,
programming,
snippets,
visual c++
Subscribe to:
Posts (Atom)