C ѧϰ±Ê¼Ç£º ÒÆÎ»²Ù×÷Á·Ï°¡£
#include <stdio.h>
unsigned int reverse_bits(unsigned int value)
{
unsigned int answer;
unsigned int i;
answer = 0;
for(i=1;i!=0;i<<=1){ //´ËÑ»·¿ÉÒÔºöÂÔ»úÆ÷µÄ²îÒì¡£64λºÍ32λ½Ô¿ÉÓã¬ÔöÇ¿´Ë´úÂëµÄ¿ÉÒÆÖ²ÐÔ
answer <<=1;
if(value & 1)
answer |= 1;
value >>=1;
}
return answer;
}
int main(void)
{
unsigned int get_answer=reverse_bits(13);
int i=31;
char t;
while(i)
{
t ='0'+ ((get_answer >> i) & 1);
printf("%c",t);
i--;
}
}
<<CºÍÖ¸Õë>> µÚ5ÕÂÁ·Ï°Ìâ¡£
Linux 2.6 kernelÖеÄset_bit²Ù×÷£º
ÐèÒª¿¼ÂÇ»úÆ÷ÊÇ32λ»¹ÊÇ64λµÄ¼ÆËã»ú¡£
static inline void set_bit(int nr, volatile unsigned long *addr)
{
int *a = (int *)addr;
int mask;
//unsigned long flags;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
//local_irq_save_hw(flags);
*a |= mask;
//local_irq_restore_hw(flags);
}
Ïà¹ØÎĵµ£º
Õû¸ö²âÊÔ×ñÑÒÔϵÄÔ¼¶¨£º
u
¼Ù¶¨ÔÚËùÓеijÌÐòÖбØÐëµÄÍ·Îļþ¶¼ÒѾ±»ÕýÈ·°üº¬¡£
¿¼ÂÇÈçϵÄÊý¾ÝÀàÐÍ£º
u
char
Ϊ
1
¸ö×Ö½Ú
u
int
Ϊ
4
¸ö×Ö½Ú
u
......
pythonµÄC¡¢c++À©Õ¹
http://blog.chinaunix.net/u3/110228/showart_2148725.html
pythonµÄÇ¿´ó²»½ö±íÏÖÔÚÆä¹¦ÄÜÉÏ£¬¶øÇÒ»¹±íÏÖÔÚÆäÀ©Õ¹ÄÜÁ¦ÉÏ¡£
ʹÓÃC/C++ºÜÈÝÒ×±àдpythonµÄÄ£¿é£¬À©Õ¹pythonµÄ¹¦ÄÜ¡£
ͬʱ½«ÐÔÄÜÒªÇó±È½Ï¸ßµÄ´úÂëʹÓÃC/C++±àд£¬ÄܸüºÃµÄÃÖ²¹
½Å±¾ÓïÑÔÖ´ÐÐËÙ¶ÈÂýµÄȱÏÝ¡£
1. pythonµÄCÓïÑÔÀ©Õ¹
1.1 ......
×î½üÔÚ×ö³ÌÐòʱÐèҪʹÓÃÒ»¸öÒѾ±àºÃµÄC³ÌÐòÔ´Îļþ£¨ÓÐÍ·Îļþ£©£¬½«Í·Îļþ¼ÓÈëÒªµ÷ÓõÄÔ´ÎļþÖУ¬µ÷ÓÃÏàÓ¦Cº¯Êý£¬±àÒëʱ³öÏÖÈçÏ´íÎó£º
sss.c(3129) : fatal error C1010: unexpected end of file while looking for precompiled header directive
ÔÚÍøÉϲéÁËÏà¹Ø×ÊÁÏ£¬Ëµ²»ÄÜÔÚCÔ´ÎļþÖаüº¬"stdafx.h"Îļþ£¬
ÖªµÀÐèÒªÒ ......
http://demonstyle.blog.163.com/blog/static/13143429020091010112159/
C/C++ ºêÏê½â
ic/c++ 2009-11-10 01:12:15 ÔĶÁ18 ÆÀÂÛ0 ×ֺţº´óÖÐС
ÖÚ¶àC++Êé¼®¶¼ÖÒ¸æÎÒÃÇCÓïÑÔºêÊÇÍò¶ñÖ®Ê×£¬µ«ÊÂÇé×ܲ»ÈçÎÒÃÇÏëÏóµÄÄÇô»µ£¬¾ÍÈçͬgotoÒ»Ñù¡£ºêÓÐ
Ò»¸öºÜ´óµÄ×÷Ó㬾ÍÊÇ×Ô¶¯ÎªÎÒÃDzúÉú´úÂë¡£Èç¹û˵ģ°å¿ÉÒÔΪÎÒÃDzúÉú¸÷ÖÖÐÍ ......
Ò»¸öCÓïÑÔÔËÐпâ´óÖ°üº¬ÁËÈçϹ¦ÄÜ:
1. Æô¶¯ÓëÍ˳ö: °üÀ¨Èë¿Úº¯Êý¼°Èë¿Úº¯ÊýËùÒÀÀµµÄÆäËüº¯ÊýµÈ
2. ±ê×¼º¯Êý: ÓÉCÓïÑÔ±ê×¼¹æ¶¨µÄCÓïÑÔ±ê×¼¿âËùÓµÓеĺ¯ÊýʵÏÖ.
3. I/O: IO¹¦Äܵķâ×°ºÍʵÏÖ
4. ¶Ñ:¶ÑµÄ·â×°ºÍʵÏÖ
5. ÓïÑÔʵÏÖ: ÓïÑÔÖÐÒ»Ð©ÌØÊ⹦ÄܵÄʵÏÖ.
6. µ÷ÊÔ: ʵÏÖµ÷ÊÔ¹¦ÄܵĴúÂë.
ÔÚÕâЩÔËÐпâµÄ×é³É³É·ÖÖÐ, C ......