Coverage for /Syzygy/common/align.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0010.C++source

Line-by-line coverage:

   1    :  // Copyright 2011 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // Utility functions to align and test alignment.
  16    :  
  17    :  #ifndef SYZYGY_COMMON_ALIGN_H_
  18    :  #define SYZYGY_COMMON_ALIGN_H_
  19    :  
  20    :  #include "base/basictypes.h"
  21    :  
  22  m :  namespace common {
  23    :  
  24    :  // @returns true iff @p value is a power of two.
  25  m :  bool IsPowerOfTwo(size_t value);
  26    :  
  27    :  // @param value the value to round up.
  28    :  // @param alignment the alignment boundary to round @p value up to.
  29    :  // @pre alignment != 0.
  30    :  // @returns @p value rounded up to the nearest higher multiple of @p alignment.
  31  m :  size_t AlignUp(size_t value, size_t alignment);
  32    :  
  33    :  // @param value the value to round up.
  34    :  // @param alignment the alignment boundary to round @p value up to.
  35    :  // @pre alignment != 0.
  36    :  // @returns @p value rounded down to the nearest lower multiple of @p alignment.
  37  m :  size_t AlignDown(size_t value, size_t alignment);
  38    :  
  39    :  // @param value the value to test.
  40    :  // @param alignment the alignment boundary to test.
  41    :  // @pre alignment != 0.
  42    :  // @returns true iff value is an even multiple of alignment.
  43  m :  bool IsAligned(size_t value, size_t alignment);
  44    :  
  45    :  // @returns true iff @p value is a power of two.
  46  m :  bool IsPowerOfTwo64(uint64 value);
  47    :  
  48    :  // @param value the value to round up.
  49    :  // @param alignment the alignment boundary to round @p value up to.
  50    :  // @pre alignment != 0.
  51    :  // @returns @p value rounded up to the nearest higher multiple of @p alignment.
  52  m :  uint64 AlignUp64(uint64 value, uint64 alignment);
  53    :  
  54    :  // @param value the value to round up.
  55    :  // @param alignment the alignment boundary to round @p value up to.
  56    :  // @pre alignment != 0.
  57    :  // @returns @p value rounded down to the nearest lower multiple of @p alignment.
  58  m :  uint64 AlignDown64(uint64 value, uint64 alignment);
  59    :  
  60    :  // @param value the value to test.
  61    :  // @param alignment the alignment boundary to test.
  62    :  // @pre alignment != 0.
  63    :  // @returns true iff value is an even multiple of alignment.
  64  m :  bool IsAligned64(uint64 value, uint64 alignment);
  65    :  
  66  m :  }  // namespace common
  67    :  
  68    :  #endif  // SYZYGY_COMMON_ALIGN_H_

Coverage information generated Tue Jun 25 13:56:24 2013.