orange-pig / OgarCommon

Lok'tar Ogar! A Common easy to use, beacuse Mother Earth in the flick with you.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I encountered a small problem using your' code ~

sxj731533730 opened this issue · comments

i copy "Byte2Bitmap(Byte[] data, int width, int height)" from your code, but i encouter a error~
###OgarCommon/OgarCommon/OgarCommon/BitmapHelper.cs###

ptr = (IntPtr)(ptr.ToInt32() + bmData.Stride);###

the error show " algorithm is abnormal "
i try to make the error "ptr.ToInt32()" to "ptr.ToInt64()"
the program is normal
我摘抄了您的一个函数,集成到我的工程中,我遇到一个“算数运算异常的错误“”,代码函数来自
OgarCommon/OgarCommon/OgarCommon/BitmapHelper.cs
程序语句
ptr = (IntPtr)(ptr.ToInt32() + bmData.Stride);
我更改为这样就没有问题了
ptr = (IntPtr)(ptr.ToInt64() + bmData.Stride);

确实存在这样的问题,因为中当时的环境中,程序员还是会优先选择32位作为自己的指针长度,而现在,大家应该已经普及了默认使用64位长度指针的**。在使用过程中,确实应该默认指针为64位长度更安全。谢谢你的提交。