任意precision位操作(目标C) [英] Arbitrary precision bit manipulation (Objective C)

查看:166
本文介绍了任意precision位操作(目标C)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做的目的C.任意precision号到目前为止,我一直在使用NSData的对象持有的数字再presentations位操作 - 是有办法的内容位移位?如果没有,是否有不同的方式来实现这一目标?

I need to do bit operations on representations of arbitrary precision numbers in Objective C. So far I have been using NSData objects to hold the numbers - is there a way to bit shift the content of those? If not, is there a different way to achieve this?

推荐答案

使用 NSMutableData 您可以获取的字节字符,改变你的位,并与 -replaceBytesInRange:withBytes:

Using NSMutableData you can fetch the byte in a char, shift your bits and replace it with -replaceBytesInRange:withBytes:.

我看不到任何其他的解决方案,除了使用的char *写你自己的日期holder类缓冲区来保存原始数据。

I don't see any other solution except for writing your own date holder class using a char * buffer to hold the raw data.

这篇关于任意precision位操作(目标C)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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