- 博客(23)
- 资源 (161)
- 收藏
- 关注
原创 【位操作笔记】位计数算法 分治法统计 2 优化版本
位计数算法 分治法统计 优化版本位计数算法说明位计数代码32位数的位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法是基于分治法(divide and conquer)的优化算法,分治法是指以两个相邻的bit位为一组,将这两个bit的数值相加,得到的结果放到大小为2bit的位段空间里。然后再将相邻的两个2bit位段数值相加,得到的结果放
2020-10-28 21:15:30 171
原创 【USB笔记】 设备描述符Device Descriptor
USB笔记 设备描述符(Device Descriptor)设备描述符(Device Descriptor)说明了USB设备的通用信息,包含应用到全部设备和所有设备配置的信息。USB设备只有一个设备描述符。设备描述符是在设备连接时主机读取的第一个描述字。此描述字所含的信息,被主机用来取得设备的额外内容。主机通过发送Get Descriptor 请求,并使设置事务中wValue 字段的高字节等于01h,来取得一个设备描述字。设备描述字提供了关于设备、设备的配置以及任何设备所归属的类的信息。Device D
2020-10-25 12:47:05 17730 2
原创 【位操作笔记】位计数算法 分治法统计
位计数算法 分治法统计位计数算法说明位计数代码32位数的位计数代码8位数的位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法运用了分治法(divide and conquer),以两个相邻的bit位为一组,将这两个bit的数值相加,得到的结果放到大小为2bit的位段空间里。然后再将相邻的两个2bit位段数值相加,得到的结果放到4bit的
2020-10-24 15:50:10 529
原创 【位操作笔记】位计数算法 使用64位指令计算12位数
位计数算法 使用64位指令计算12位数位计数算法说明位计数代码位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法用于计算最大为12位的数。这个算法需要在支持快速模除的64位CPU上才能达到高性能的效果。计算12位数的位置1的个数,只需要3次操作。位计数代码位计数代码unsigned int count_12bit(unsigned
2020-10-24 15:39:20 529
原创 【位操作笔记】位计数算法 使用64位指令计算32位数
位计数算法 使用64位指令计算32位数位计数算法说明位计数代码位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法用于计算32位的数。这个算法需要在支持快速模除的64位CPU上才能达到高性能的效果。计算32位数的位置1的个数,只需要15次操作。位计数代码位计数代码unsigned int count_32bit(unsigned i
2020-10-24 00:06:27 969
原创 【位操作笔记】位计数算法 使用64位指令计算24位数
位计数算法 使用64位指令计算24位数位计数算法说明位计数代码位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法用于计算最大为24位的数。这个算法需要在支持快速模除的64位CPU上才能达到高性能的效果。计算24位数的位置1的个数,只需要10次操作。位计数代码位计数代码unsigned int count_24bit(unsigne
2020-10-22 00:17:47 1157
原创 【位操作笔记】位计数算法 使用64位指令计算14位数
位计数算法 使用64位指令计算14位数位计数算法说明位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明这个算法需要在支持快速模除的64位CPU上才能达到高性能的效果。计算14位数的位置1的个数,只需要3次操作。位计数代码unsigned int count_14bit(unsigned int x){ x = (x * 0x20
2020-10-17 14:42:59 598
原创 【位操作笔记】位计数算法 Brian Kernighan的方法
位计数算法 Brian Kernighan方法位计数算法说明位计数算法代码32位数的位计数代码8位数的位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法每次清除从最低位到最高位数的第一个为1的位,运算次数取决于二进制位中1的个数。位计数算法代码32位数的位计数代码unsigned int count(unsigned int v)
2020-10-17 11:36:43 456
原创 【位操作笔记】位计数算法 半字节查表法 32位数
位计数算法 半字节查表法 32位数位计数算法说明位计数代码32位数的位计数代码 方法一32位数的位计数代码 方法二算法计算过程拓展表的生成方法一表的生成 方法二表格生成结果[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法通过查表的方式来计算一个数里bit位置1的个数。算法采用半字节查表法,与一般的查表法相比,减少了空间的占用,增加了查表次数。正常查表法参照位操作笔
2020-10-17 10:53:48 311
原创 【位操作笔记】位计数算法 半字节查表法 8位数
位计数算法 半字节查表法位计数算法说明位计数代码8位数的位计数代码算法计算过程拓展32位数的位计数代码算法计算过程表的生成[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法通过查表的方式来计算一个数里bit位置1的个数。算法采用半字节查表法,与一般的查表法相比,减少了空间的占用,增加了查表次数。正常查表法参照位操作笔记 位计数算法 查表法 8位数。位计数代码8位
2020-10-17 10:36:24 281
原创 【位操作笔记】位计数算法 查表法 32位数
位计数算法 查表法 32位数位计数算法说明位计数代码32位数的位计数代码 方法一32位数的位计数代码 方法二算法来源算法计算过程拓展表的生成方法一表的生成 方法二表格生成结果[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法通过查表的方式来计算一个数里bit位置1的个数。32bit数最多有4294967296种情况,所以生成32位数的表来进行查表是不合适的,由于8b
2020-10-16 23:29:22 1307
原创 【位操作笔记】位计数算法 查表法 8位数
位计数算法 查表法位计数算法说明位计数代码8位数的位计数代码算法来源算法计算过程拓展32位数的位计数代码算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法通过查表的方式来计算一个数里bit位置1的个数。由于8bit数最多只有256个,也就是最多只有256种情况,所以直接通过建表的方式,将这256种情况全部列出来。使用查表法进行位计数的速度最快。位计数代
2020-10-16 23:04:25 1101
原创 【位操作笔记】位计数算法 普通方法
位计数算法 普通方法位计数算法说明位计数算法代码32位数的位计数代码8位数的位计数代码算法来源算法计算过程[参考资料]位计数位计数(Counting bits set),指的是计算一个数里bit位置1的个数,例如一个8位数0xea = 0b1110 1010,位置1的个数为5。算法说明该算法通过循环遍历数的每一个bit,判断每个bit是否为1,直到结束。如果是8位数,最坏情况为当最高位为1时,会循环8次;如果是32位数,最坏情况为当最高位为1时,会循环32次。位计数算法代码32位数的位计数代码
2020-10-16 22:40:52 977
原创 【位操作笔记】位反转算法 时间复杂度O(lg(N))
位反转算法位反转算法说明位反转算法代码32位数的位反转代码8位数的位反转代码算法来源算法计算过程[参考资料]位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将任意 2N2^N2N 位数的数进行位反转。运算的时间复杂度是O(lg(N))。与位反转算法 通过5 * lg(N)次运算完成相比,这个算法的优点是常数在过程中计算,可以减少内存占
2020-10-07 16:08:17 611
原创 【位操作笔记】位反转算法 通过5 * lg(N)次运算完成
位反转算法 5 * lgN次运算 位反转算法说明位反转算法代码算法来源算法计算过程拓展[参考资料]位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将任意 2n2^n2n 位数的数进行位反转。运算次数为5 * lg(N)次, 由所要反转的数的位数决定,例如要反转32位数,N = 32,那么运算次数为5 * lg(32) = 25次; 要
2020-10-07 14:10:56 361
原创 【位操作笔记】位反转算法 愚蠢的方法
位反转算法 愚蠢的方法位反转算法说明位反转算法代码算法计算过程拓展[参考资料]位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将8bit数进行位反转。直接把数的所有bit位依照中点对换位置,过程直白,但是效率低。位反转算法代码unsigned char reverse(unsigned char x){#define SWAP
2020-10-07 13:05:07 597
原创 【位操作笔记】位反转算法 容易理解的方法
位反转算法 容易理解的方法位反转算法说明位反转算法代码32位数的位反转代码8位数的位反转代码算法来源算法计算过程[参考资料]位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于任意位数的位反转。位反转算法代码32位数的位反转代码unsigned int reverse(unsigned int v){ unsigned i
2020-10-07 12:10:11 2901
原创 【位操作笔记】位反转算法 通过4次运算完成
位反转算法 4次运算位反转算法说明位反转算法代码算法来源算法计算过程拓展位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将8bit数进行位反转。算法用到了64bit乘法运算。算法通过4次运算完成位反转操作。位反转算法代码unsigned char reverse(unsigned char x){ x = ((x * 0
2020-10-06 22:12:22 1166
原创 【位操作笔记】位反转算法 通过3次运算完成
位反转算法 3次运算位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将8bit数进行位反转。算法用到了64bit乘法与取模运算。位反转算法代码unsigned char reverse(unsigned char x){ x = (x * 0x0202020202ULL & 0x010884422010ULL)
2020-10-06 20:32:20 1289
原创 【位操作笔记】位反转算法 半字节查表法
位反转算法 半字节查表法位反转算法说明位反转算法代码算法计算过程拓展位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将8bit数通过查表的方式进行位反转。算法采用半字节查表法,与一般的查表法相比,减少了空间的占用。位反转算法代码unsigned char reverse_table[] = { 0x0, 0x8, 0x4
2020-10-06 11:47:55 774
原创 【位操作笔记】位反转算法 查表法
位反转算法 查表法位反转算法说明位反转算法代码算法计算过程拓展位反转这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。算法说明该算法用于将8bit数通过查表的方式进行位反转。由于8bit数最多只有256个,也就是反转的数最多只有256个,所以直接通过建表的方式,将这256种情况全部列出来。使用查表法进行位反转的速度最快。位反转算法代码unsigned ch
2020-10-06 10:51:28 1117
原创 【位操作笔记】位反转算法 通过7次运算完成
一种位反转算法 by Sean Anderson位反转说明位反转算法代码算法说明算法来源算法计算过程拓展位反转说明这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。位反转算法代码unsigned char reverse(unsigned char x){ x = ((x * 0x0802LU & 0x22110LU) | (x * 0x80
2020-10-05 22:56:36 647
原创 【位操作笔记】详解一种高效位反转算法
详解一种高效位反转算法这里的位反转(Bit Reversal),指的是一个数的所有bit位依照中点对换位置,例如0b0101 0111 => 0b1110 1010。也可以叫二进制逆序,按位逆序,位翻转等等。高效位反转算法原理:算法运用了分治法(divide and conquer),以两个bit位一组,对调相邻的bit位;然后再以4个bit位为一组,分成左边两个bit位一段和右边两个bit位一段,然后这两段相互对调;然后再以8个bit位为一组,以此类推,最后完成位反转。下面举例一个32位数的
2020-10-01 21:59:57 10880 10
USB Type-C Port Controller Interface Specification
2022-12-03
基于STM32的事件驱动框架的应用
2022-02-03
PWG Command Set Format for IEEE 1284 Device ID v1.0
2021-12-26
USB 3.2 ECN Remove WiMax Friendly SSC.pdf
2021-08-16
USB 3.2 ECN Gen2 SKP OS Insertion in PollingRxEQ.pdf
2021-08-16
USB 3.2 ECN Gen1 SSCdf_dt Limit.pdf
2021-08-16
USB 3.2 ECN BLR JTF - Jitter Gain limit change .pdf
2021-08-15
USB 3.2 ECN - System RFI spec_add CP0.pdf
2021-08-15
USB 3 2 ECN Gen 1x2 SKP OS Correction.pdf
2021-08-15
USB Billboard Revision 1.2.2 - CLEAN.pdf
2021-08-14
USB BC 1.2 Compliance Plan rev 1.2.pdf
2021-08-14
USB Type-C_Compliance Document_Rev_2_1b_June_2021_CB.pdf
2021-08-13
USB Type-C_Compliance Document_Rev_2_1b_June_2021.pdf
2021-08-13
USB_PD_2_0_Compliance_Plan_v1_02.pdf
2021-08-13
Deterministic PD Compliance MOI 1.pdf
2021-08-12
Communication Engine PD Compliance MOI v1p9.pdf
2021-08-12
USB_Power_Delivery_3 0 _Tests_v1p14 r2.pdf
2021-08-12
USB PD3 CTS r1.2 v2.pdf
2021-08-11
Intel USB4 Evaluation Dock BKC Files Installer
2021-08-11
USB4 USB3 Tunneling CTS Rev 1.1 - REDLINE.pdf
2021-08-11
USB4 TMU CTS 1.1 - REDLINE.pdf
2021-08-10
USB4 Protocol CTS Rev 1.2 - REDLINE.pdf
2021-08-10
USB4 PCIe Tunneling CTS Rev 1.1 - REDLINE.pdf
2021-08-10
USB4 Logical Layer CTS Rev 1.2 - REDLINE.pdf
2021-08-09
USB4 Host Interface CTS Rev 1.1 - REDLINE.pdf
2021-08-09
USB4 USB3 Tunneling CTS Rev 1.1 - CLEAN.pdf
2021-08-09
USB4 TMU CTS 1.1 - CLEAN.pdf
2021-08-08
USB4 Protocol CTS Rev 1.2 - CLEAN.pdf
2021-08-08
USB4 PCIe Tunneling CTS Rev 1.1 - CLEAN.pdf
2021-08-08
USB4 Logical Layer CTS Rev 1.2 - CLEAN.pdf
2021-08-07
USB4 Host Interface CTS Rev 1.1 - CLEAN.pdf
2021-08-07
USB4 DP Tunnel CTS Rev 1.0.pdf
2021-08-07
Vendor_Info_File_v3.16.pdf
2021-08-07
SuperMUTT firmware version 57 with update procedure.zip
2021-08-06
SuperMUTT Firmware Update Procedure Rev1.00.pdf
2021-08-06
USB-C Bridge Rev 1 1 - Redline.pdf
2021-08-06
USB3CV 2.2.0.0 Installer - x86 Release
2021-08-05
USB-C Bridge Rev 1 1 - Clean.pdf
2021-08-05
USB_3_0_Adopters_Agreement_Final_020411.pdf
2021-08-05
USB4_SigTest_User_Manual rev0p6.pdf
2021-08-05
是否允许同一个tasklet在多个CPU上并行执行?
2022-09-18
EAS调度器如何衡量一个进程的计算能力
2022-09-17
TA创建的收藏夹 TA关注的收藏夹
TA关注的人