ARM Technical Support Knowledge Articles

_PRIORD_ INTRINSIC LIBRARY ROUTINE

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

Is there a way in C to use the PRIOR assembly instruction to normalize a 32-bit value?

ANSWER

Yes. The _priord_ intrinsic library routine uses the PRIOR instruction to count the number of shifts required to normalize a 32-bit number. The return value is a number from 0 to 31 which indicates how many times the number must be shifted left before the MSB is set. For example:

#include <intrins.h>

void testprior (long val)  {
  volatile int temp;

  temp = _priord_ (val);
}

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-10-20 07:42:52

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential