[llvm-commits] [llvm] r43421 - in /llvm/trunk: include/llvm/Support/Alignment.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp

Chris Lattner clattner at apple.com
Tue Nov 6 15:45:29 PST 2007


On Oct 28, 2007, at 5:59 AM, Duncan Sands wrote:

> Author: baldrick
> Date: Sun Oct 28 07:59:45 2007
> New Revision: 43421
> +//===----------- Alignment.h - Alignment computation ------------ 
> *- C++ -*-===//

Hi Duncan,

instead of introducing a new header file for this, would it make  
sense to merge into MathExtras.h?

-Chris

> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file was developed by Duncan Sands and is distributed under
> +// the University of Illinois Open Source License. See LICENSE.TXT  
> for details.
> +//
> +// 
> ===------------------------------------------------------------------- 
> ---===//
> +//
> +// This file defines utilities for computing alignments.
> +//
> +// 
> ===------------------------------------------------------------------- 
> ---===//
> +
> +#ifndef LLVM_SUPPORT_ALIGNMENT_H
> +#define LLVM_SUPPORT_ALIGNMENT_H
> +
> +namespace llvm {
> +
> +/// MinAlign - A and B are either alignments or offsets.  Return  
> the minimum
> +/// alignment that may be assumed after adding the two together.
> +
> +static inline unsigned MinAlign(unsigned A, unsigned B) {
> +  // The largest power of 2 that divides both A and B.
> +  return (A | B) & -(A | B);
> +}
> +
> +} // end namespace llvm
> +#endif




More information about the llvm-commits mailing list