快速的寄存器内字节排序? [英] Fast in-register sort of bytes?

查看:133
本文介绍了快速的寄存器内字节排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于一个4字节的寄存器(对于SIMD,则为16),必须有一种有效的方法来用几条指令对寄存器中的字节进行排序.

Given a register of 4 bytes (or 16 for SIMD), there has to be an efficient way to sort the bytes in-register with a few instructions.

谢谢.

推荐答案

查找有效的分拣网络 N =您关心的字节数(4或16).将其转换为比较和交换指令序列. (不过,对于N = 16,这将大于几个".)

Look up an efficient sorting network for N = the number of bytes you care about (4 or 16). Convert that to a sequence of compare and exchange instructions. (For N=16 that'll be more than 'a few', though.)

这篇关于快速的寄存器内字节排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆