最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can memcpy in visual studio 2022 have a max memory load size be controled or reported? - Stack Overflow

programmeradmin1浏览0评论

I wonder if there is a way to tell memcpy() in visual studio 2022 to only move up to 32bit, 64bit or 128bits at a time or if it could tell me in the preprocessor what the max size it may use.

This is a special need, but while I can assume 256bits today, if it moves to 512bits it will break the expected copy.

The solution would be to either tell memcpy() what the max bits (or bytes) it can use, or have something defined in visual studio that tells me how many bits (or bytes) it could use; I could then #if an #error when the size becomes too large it could be adjusted and fixed when the compile fails.

Or even something like the SIMD level as a value so could say if <= SSE4 it's 128bits, <= AVX2 it's 256bits, and if > AFX2 #error.

Does something like that exist?

Is the #pragma omp simd safelen(length) before a memcpy() what I'm looking for?

I don't think so, looking at the memcpy disassembly, looks like I had better roll my own.

TIA!!

发布评论

评论列表(0)

  1. 暂无评论