My MSN

Click OK to add this content

 
Content Preview: rss
-+一组用于hash table 的素数表
768 days ago
在写hash表的时候,要选择一个素数作为桶的大小,当桶太小时则要对其扩展。 合适扩展呢?设置一个桶和节点的比例因子factor,当节点个数nNode/桶的大小nBucket > factor时扩展。 如何扩展呢?偶的方法是下一个桶的大小就选择 nBucket/factor得到,于是建立了一个表,查表得到下一个桶的大小 表的数据如下: static const size_t  g_hash_prime_list[] = {        61,       83,      113,      151,      211,      281,      379,      509,       683,      911,     1217,     1627,     2179,     2909,     3881,     5179,      6907,     9209,    12281,    16381,    21841,    29123,    38833,    51787,     69061,    92083,   122777,   163729,   218357,   291143,   388211,   517619,    690163,   920219,  1226959,  1635947,  2181271,  2908361,  3877817,  5170427,   6893911,  9191891, 12255871, 16341163, 21788233, 29050993, 38734667, 51646229,  68861641, 91815541,122420729,163227661,217636919,290182597,386910137,515880193,  687840301,917120411,1222827239,1610612741, 3221225473ul, 4294967291ul }; static const int g_hash_primes_num = ARRAY_SIZE(g_hash_prime_list);生成这个表的程序如下: #include<stdio.h> #include<math.h> bool ...
-+请小心在你的构造和析构函数调用其他函数
806 days ago
今天读了《Effective C++ 》,第9条原则, 绝不 要在 构造和析构函数 中调用 Virtual函数 ,我们都知道当调用一个 虚函数 的时候,调用的将是被 直接实例化的类或者其基类的实现 ,但是,如果在 构造 或者 析构函数 中 调用虚函数 ,还会遵循这种规则么? 答案是: NO 请看下面的这段代码 #include <stdio.h> class CQBase { public : CQBase () { printLog (); }; virtual ~ CQBase () { printLog (); }; virtual void printLog () { printf ( "CQBase\n" ); } }; class CQDerived : public CQBase { public : CQDerived () { printLog (); }; virtual ~ CQDerived () { printLog (); }; virtual void printLog () { printf ( "CQDerived\n" ); } }; int main ( int argc , ...
-+反调试系列二:ZwSetInformationThread
906 days ago
ZwSetInformationThread 可以用来将线程隐藏,从而使调试器接收不到信息 其原型如下: NTSTATUS NTAPI ZwSetInformationThread (     __in HANDLE ThreadHandle,     __in THREADINFOCLASS ThreadInformationClass,     __in_bcount(ThreadInformationLength) PVOID ThreadInformation,     __in ULONG ThreadInformationLength     ); // // Thread Information Classes定义如下 //ntpsapi.h typedef enum _THREADINFOCLASS {     ThreadBasicInformation,     ThreadTimes,     ThreadPriority,     ThreadBasePriority,     ThreadAffinityMask,     ThreadImpersonationToken,     ThreadDescriptorTableEntry,     ThreadEnableAlignmentFaultFixup,     ThreadEventPair_Reusable,     ThreadQuerySetWin32StartAddress,     ThreadZeroTlsCell,     ThreadPerformanceCount,     ThreadAmILastThread,     ThreadIdealProcessor,     ThreadPriorityBoost,     ThreadSetTlsArrayAddress,     ThreadIsIoPending,     ThreadHideFromDebugger ,//这个就是用来将线程对调试器隐藏     ThreadBreakOnTermination,     ThreadSwitchLegacyState,     ThreadIsTerminated,     MaxThreadInfoClass     } ...
-+花生快快长
909 days ago
闲来无事,五一期间在阳台上种了两棵花生,现在已经开花了 应两棵花生的各位粉丝们(花生酱)的热切要求,尤其是小飞, 现独家爆几张内部写真,需要签名照的,请电邮我!
-+花生茁壮成长
909 days ago
No description is available for this feed.
© 2009 MicrosoftMicrosoft