IceUtils.cpp
Go to the documentation of this file.
00001 
00002 
00008 
00009 
00011 // Precompiled Header
00012 #include "Stdafx.h"
00013 
00014 using namespace IceCore;
00015 
00017 
00023 
00024 udword IceCore::Alignment(udword address)
00025 {
00026         // Returns 0 for null addresses
00027         if(!address) return 0;
00028 
00029         // Test all bits
00030         udword Align = 1;
00031         for(udword i=1;i<32;i++)
00032         {
00033                 // Returns as soon as the alignment is broken
00034                 if(address&Align)       return Align;
00035                 Align<<=1;
00036         }
00037         // Here all bits are null, except the highest one (else the address would be null)
00038         return Align;
00039 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:17