LCOV - code coverage report
Current view: directory - src/trusted/validator/x86/decoder - ncop_exps_inl.c (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 19 16 84.2 %
Date: 2012-02-16 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2012 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can be
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : /*
       8                 :  * ncop_exps_inl.c - Holds inline routines for commonly used (simple)
       9                 :  * functions in ncop_exps.h. Used to speed up code. Inlined routines
      10                 :  * correspond to the following functions in ncop_exps.h, but with an
      11                 :  * 'Inline' suffix:
      12                 :  *
      13                 :  *    NaClGetExpRegister
      14                 :  */
      15                 : #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_INL_H_
      16                 : #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_INL_H_
      17                 : 
      18                 : #include <assert.h>
      19                 : #include "native_client/src/trusted/validator/x86/decoder/ncop_exps.h"
      20                 : 
      21             976 : static INLINE NaClOpKind NaClGetExpRegisterInline(NaClExp* node) {
      22             976 :   assert(node->kind == ExprRegister);
      23             976 :   return (NaClOpKind) node->value;
      24                 : }
      25                 : 
      26                 : /* Return the sign extended integer in the given expr node. */
      27             407 : static INLINE int64_t NaClGetExprSignedValue(NaClExp* node) {
      28             407 :   if (node->flags & NACL_EFLAG(ExprSize8)) {
      29             301 :     return (int8_t) node->value;
      30             106 :   } else if (node->flags & NACL_EFLAG(ExprSize16)) {
      31               0 :     return (int16_t) node->value;
      32             106 :   } else if (node->flags & NACL_EFLAG(ExprSize32)) {
      33             106 :     return (int32_t) node->value;
      34                 :   } else {
      35               0 :     return (int64_t) node->value;
      36                 :   }
      37                 : }
      38                 : 
      39                 : /* Return the zero padded integer in the given expr node. */
      40             372 : static INLINE uint64_t NaClGetExprUnsignedValue(NaClExp* node) {
      41             372 :   if (node->flags & NACL_EFLAG(ExprSize8)) {
      42             295 :     return (uint8_t) node->value;
      43              77 :   } else if (node->flags & NACL_EFLAG(ExprSize16)) {
      44              11 :     return (uint16_t) node->value;
      45              66 :   } else if (node->flags & NACL_EFLAG(ExprSize32)) {
      46              66 :     return (uint32_t) node->value;
      47                 :   } else {
      48               0 :     return (uint64_t) node->value;
      49                 :   }
      50                 : }
      51                 : 
      52                 : #endif  /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_INL_H_ */

Generated by: LCOV version 1.7