Mercurial > hg > octave-lyh
comparison scripts/strings/strchr.m @ 12474:26d3164fd58d
strchr.m: avoid implict string to number conversion
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 24 Feb 2011 02:07:37 -0500 |
parents | c792872f8942 |
children | 9da8fbd17b92 |
comparison
equal
deleted
inserted
replaced
12473:95b1c64c287f | 12474:26d3164fd58d |
---|---|
44 endfor | 44 endfor |
45 else | 45 else |
46 ## Index the str into a mask of valid values. This is slower than | 46 ## Index the str into a mask of valid values. This is slower than |
47 ## it could be because of the +1 issue. | 47 ## it could be because of the +1 issue. |
48 f = false (1, 256); | 48 f = false (1, 256); |
49 f(chars + 1) = true; | 49 f(uint8(chars)+1) = true; |
50 ## Default goes via double -- unnecessarily long. | 50 ## Default goes via double -- unnecessarily long. |
51 si = uint32 (str); | 51 si = uint32 (str); |
52 ## in-place | 52 ## in-place |
53 ++si; | 53 ++si; |
54 mask = reshape (f(si), size (str)); | 54 mask = reshape (f(si), size (str)); |