不同的strcmp
2015-10-23 15:25
141 查看
Android libc中的strcmp
https://android.googlesource.com/platform/bootable/bootloader/legacy/+/donut-release/libc/strcmp.c
int strcmp(const char *a, const char *b)
{
while(*a && *b) {
if(*a++ != *b++) return 1;
}
if(*a || *b) return 1;
return 0;
}
ios中libc中的strcmp
http://www.opensource.apple.com/source/Libc/Libc-262/ppc/gen/strcmp.c
int strcmp(const char *s1, const char *s2)
{
for ( ; *s1 == *s2; s1++, s2++)
if (*s1 == '\0')
return 0;
return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
}
https://android.googlesource.com/platform/bootable/bootloader/legacy/+/donut-release/libc/strcmp.c
int strcmp(const char *a, const char *b)
{
while(*a && *b) {
if(*a++ != *b++) return 1;
}
if(*a || *b) return 1;
return 0;
}
ios中libc中的strcmp
http://www.opensource.apple.com/source/Libc/Libc-262/ppc/gen/strcmp.c
int strcmp(const char *s1, const char *s2)
{
for ( ; *s1 == *s2; s1++, s2++)
if (*s1 == '\0')
return 0;
return ((*(unsigned char *)s1 < *(unsigned char *)s2) ? -1 : +1);
}
相关文章推荐
- 提高MYSQL大数据量查询的速度
- 用MyEclipse自带工具生成WebService客户端代码
- mysql分表场景分析与简单分表操作
- [Angular 2] Use Service use Typescript
- js echo中对像转成字符串
- Registry Settings that can be Modified to Improve Operating System Performance
- app测试点
- Oracle数据库备份、恢复 - 使用PL/SQL Developer 导入、导出Oracle数据库
- RosettaNet
- win7 ShuipFCMS 配置 及问题
- 整理hibernate.cfg.xml 与 applicationContext之间的配置方式
- 非常好的理解遗传算法的例子
- Windows2008 R2上完全卸载Oracle操作步骤
- (转)在eclipse下远程调试hadoop2.0
- VC6 实现GBK到UTF8编码转换(c++)
- Windows2008 R2上完全卸载Oracle操作步骤
- 最长01串 SDUT 3308
- typedef和define的区别
- Office 2010启动时出现无法验证此应用程序的许可证的解决
- Delete All Umbraco Members by SQL Script (转自http://staheri.com/my-blog/2015/july/delete-all-umbraco-members-by-sql-script/)