Mercurial > octave-nkf
comparison scripts/general/bitset.m @ 10635:d1978e7364ad
Print name of function in error() string messages.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 16 May 2010 22:26:54 -0700 |
parents | 16f53d29049f |
children | be55736a0783 |
comparison
equal
deleted
inserted
replaced
10634:60542efcfa2c | 10635:d1978e7364ad |
---|---|
72 _conv = @int32; | 72 _conv = @int32; |
73 elseif (isa (A, "int64")) | 73 elseif (isa (A, "int64")) |
74 Amax = 64; | 74 Amax = 64; |
75 _conv = @int64; | 75 _conv = @int64; |
76 else | 76 else |
77 error ("invalid class %s", class (A)); | 77 error ("bitset: invalid class %s", class (A)); |
78 endif | 78 endif |
79 Bmax = intmax (class (A)); | 79 Bmax = intmax (class (A)); |
80 endif | 80 endif |
81 | 81 |
82 m = double (n(:)); | 82 m = double (n(:)); |
83 if (any (m < 1) || any (m > Amax)) | 83 if (any (m < 1) || any (m > Amax)) |
84 error ("n must be in the range [1,%d]", Amax); | 84 error ("bitset: n must be in the range [1,%d]", Amax); |
85 endif | 85 endif |
86 | 86 |
87 mask = bitshift (_conv (1), uint8 (n) - uint8 (1)); | 87 mask = bitshift (_conv (1), uint8 (n) - uint8 (1)); |
88 X = bitxor (A, bitand (A, mask)); | 88 X = bitxor (A, bitand (A, mask)); |
89 | 89 |