memcmp for far pointers

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

memcmp for far pointers

跳至解决方案
2,031 次查看
michaelsarafidi
Contributor II

Hi there,

 

i am using Codewarrior IDE 5.9.0 build 5294 and i am trying to compare 2 tables with memcmp.

if both tables are in near memory then there is no problem. if one of them is in far memory then memcmp does not get the correct address.

it gets a 16bit address. I know that in standard c there is also _fmemcmp for far pointers. I am including ansib.lib that does not include _fmemcmp.

Should i include a different library or there is another workarround?

 

Thanks in advance.

标签 (1)
1 解答
1,714 次查看
kef
Specialist I

Hi

I think it's easiest to take some known memcmp implementation, rename it, and just add missing far keywords.

c/c++ memcmp: c++ - Implementing memcmp - Stack Overflow

在原帖中查看解决方案

3 回复数
1,714 次查看
michaelsarafidi
Contributor II


Thank you both.

I have created my own memcmp for far pointers as Edward proposed.

0 项奖励
回复
1,714 次查看
CrasyCat
Specialist III

Hello

ANSI libraries delivered with CodeWarrior for HCS12 are configured to handle near pointers if you are building in banked memory model.

This post provides you with some hint son how you can get memcpy or memcmp to handle far pointer as well.

CrasyCat

1,715 次查看
kef
Specialist I

Hi

I think it's easiest to take some known memcmp implementation, rename it, and just add missing far keywords.

c/c++ memcmp: c++ - Implementing memcmp - Stack Overflow