TheGreyBeast
Programmer
In Visual C++, the functions memcmp, memcpy and memset are all intrinsics (which makes them really fast), but is there a way to make memchr intrinsic too?
Also, I'd like to make a new intrinsic function which searches a string and stops if it encounters a character other than al. For example, if al is 0 and the string is 00 00 00 06 FF ... then the string will repeat 3 times. The code in asm for this is:
The question is: How can I make my own intrinsic function, or at least achieve the same performance as if it was an intrinsic function? How can I do this to achieve the best performance? Thanks.
Also, I'd like to make a new intrinsic function which searches a string and stops if it encounters a character other than al. For example, if al is 0 and the string is 00 00 00 06 FF ... then the string will repeat 3 times. The code in asm for this is:
Code:
xor al, al ; al = 0
repe scasb ; repeat and stop when the string contains
; a value other than 0
The question is: How can I make my own intrinsic function, or at least achieve the same performance as if it was an intrinsic function? How can I do this to achieve the best performance? Thanks.