• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ INT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中INT函数的典型用法代码示例。如果您正苦于以下问题:C++ INT函数的具体用法?C++ INT怎么用?C++ INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了INT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: if

void EggAvatar::DrawSegment(IFTImage* pImage, int firstPoint, int secondPoint, UINT32 color)
{
    float x1 = m_FacePointXYZ[firstPoint][0];
    float y1 = m_FacePointXYZ[firstPoint][1];
    float z1 = m_FacePointXYZ[firstPoint][2];
    float x2 = m_FacePointXYZ[secondPoint][0];
    float y2 = m_FacePointXYZ[secondPoint][1];
    float z2 = m_FacePointXYZ[secondPoint][2];

    if (z1 < 0)
    {
        if (z2 > 0)
        {
            float r = z2/(z2-z1);
            x1 = x2 - r*(x2-x1);
            y1 = y2 - r*(y2-y1);
        }
        else
        {
            // Segment is completely hidden
            return;
        }
    }
    else if (z2 < 0)
    {
        if (z1 > 0)
        {
            float r = z1/(z2-z1);
            x2 = x1 + r*(x1-x2);
            y2 = y1 + r*(y1-y2);
        }
        else
        {
            // Segment is completely hidden
            return;
        }
    }
    
    POINT start = {INT(x1), INT(y1)}, end = {INT(x2), INT(y2)};
    pImage->DrawLine(start, end, color, 1);
}
开发者ID:guerre50,项目名称:FacialMusicRendering,代码行数:41,代码来源:eggavatar.cpp


示例2: obj

DisplayError DisplayHDMI::Init() {
  lock_guard<recursive_mutex> obj(recursive_mutex_);

  DisplayError error = HWInterface::Create(kHDMI, hw_info_intf_, buffer_sync_handler_,
                                           &hw_intf_);
  if (error != kErrorNone) {
    return error;
  }

  uint32_t active_mode_index;
  char value[64] = "0";
  Debug::GetProperty("sdm.hdmi.s3d_mode", value);
  HWS3DMode mode = (HWS3DMode)atoi(value);
  if (mode > kS3DModeNone && mode < kS3DModeMax) {
    active_mode_index = GetBestConfig(mode);
  } else {
    active_mode_index = GetBestConfig(kS3DModeNone);
  }

  error = hw_intf_->SetDisplayAttributes(active_mode_index);
  if (error != kErrorNone) {
    HWInterface::Destroy(hw_intf_);
  }

  error = DisplayBase::Init();
  if (error != kErrorNone) {
    HWInterface::Destroy(hw_intf_);
    return error;
  }

  GetScanSupport();
  underscan_supported_ = (scan_support_ == kScanAlwaysUnderscanned) || (scan_support_ == kScanBoth);

  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatNone, kS3DModeNone));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatLeftRight, kS3DModeLR));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatRightLeft, kS3DModeRL));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatTopBottom, kS3DModeTB));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatFramePacking, kS3DModeFP));

  error = HWEventsInterface::Create(INT(display_type_), this, event_list_, &hw_events_intf_);
  if (error != kErrorNone) {
    DisplayBase::Deinit();
    HWInterface::Destroy(hw_intf_);
    DLOGE("Failed to create hardware events interface. Error = %d", error);
  }

  return error;
}
开发者ID:MIPS,项目名称:hardware-qcom-display,代码行数:53,代码来源:display_hdmi.cpp


示例3: BlockForFiltLineI

/***********************************************************************
*   Returns 1-based block number for line number (i.e. first = 1)
*   Lines assumed 1-based (i.e. first = 1); 
*/
int BlockForFiltLineI(FILTER *filtPO, int line)
{
    int block;

    if( line <= filtPO->l_bof ) {
        block = 0;
    }
    else {
        block = 1 + INT((line - 1 - filtPO->l_bof) / filtPO->l_blk);
    }
    return(block);
}
开发者ID:ryantkoehler,项目名称:vertools,代码行数:16,代码来源:filter.c


示例4: R_PDCLVAR

SEXP R_PDCLVAR(SEXP X, SEXP DESCX, SEXP LSD)
{
  R_INIT;
  SEXP VAR;
  
  newRvec(VAR, INT(LSD, 0), "dbl");
  
  pdclvar_(REAL(X), INTEGER(DESCX), REAL(VAR));
  
  R_END;
  return VAR;
} 
开发者ID:RBigData,项目名称:pbdBASE,代码行数:12,代码来源:base_variance.c


示例5: SetOpt

REAL cIncEnsembleCamera::ScoreCurGen(bool WithFaux,bool CumulDeriv)
{
    SetOpt();
    REAL mMoyResidu = 0.0;
    REAL  mNbPts = 0.0;

    for 
    (
             std::list<cIncSetLiaison *>::iterator anIt = mListSl->begin(); 
             anIt != mListSl->end();
             anIt ++
    )
    {
         cIncCpleCamera * aCple = (*anIt)->Cple();
         ElPackHomologue & aPack = (*anIt)->Pack();
         for
         (
                ElPackHomologue::iterator itHoms = aPack.begin();
                itHoms != aPack.end();
                itHoms++
         )
         {
            Pt2dr aP1 = itHoms->P1();
            Pt2dr aP2 = itHoms->P2();
            REAL aPds =  itHoms->Pds();

            REAL Residu = CumulDeriv ?
                          aCple->DevL1AddEqCoPlan(aP1,aP2,aPds,*mSys):
                          aCple->ValEqCoPlan(aP1,aP2);

            mMoyResidu += ElSquare(Residu )* aPds;
            mNbPts += aPds;
         }
    }

    if (WithFaux)
    {
       for (INT aK = 0 ; aK<INT(mFoncsAux.size()) ; aK++)
       {
            cFonctrPond aFP = mFoncsAux[aK];
            
            if (CumulDeriv)
               StdAddEq(aFP.mFctr,aFP.mPds);
            else
               aFP.mFctr->ComputeValAndSetIVC();
            mMoyResidu += ElSquare(aFP.mFctr->Val(0)) * aFP.mPds;
            mNbPts +=  aFP.mPds;
       }
    }


    return mMoyResidu / mNbPts;
}
开发者ID:jakexie,项目名称:micmac-archeos,代码行数:53,代码来源:phgr_or_opt.cpp


示例6: AddDessouSansDessus

void  cElHJaFacette::AddDessouSansDessus(std::vector<cElHJaFacette *> & aTabF)
{
   for (INT aK=0 ; aK<INT(mVFRecouvrt.size()) ; aK++)
   {
       if ( mThisIsEnDessus[aK])
       {
            mVFRecouvrt[aK]->mNbThisIsEnDessous--;
            if (mVFRecouvrt[aK]->mNbThisIsEnDessous==0)
               aTabF.push_back(mVFRecouvrt[aK]);
       }
   }
}
开发者ID:jakexie,项目名称:micmac,代码行数:12,代码来源:cElHJaFacette.cpp


示例7: Rth_get_num_threads

SEXP Rth_get_num_threads()
{
  char *rth_nthreads = getenv("RTH_NUM_THREADS");
  char *omp_nthreads = getenv("OMP_NUM_THREADS");
  
  SEXP nthreads;
  PROTECT(nthreads = allocVector(INTSXP, 1));
  
  #if RTH_OMP
  if (rth_nthreads != NULL)
    INT(nthreads) = atoi(rth_nthreads);
  else if (omp_nthreads != NULL)
    INT(nthreads) = atoi(omp_nthreads);
  else
    INT(nthreads) = omp_get_max_threads(); // omp_get_max_threads
  #elif RTH_TBB
  if (rth_nthreads != NULL)
    INT(nthreads) = atoi(rth_nthreads);
  else
    INT(nthreads) = tbb::task_scheduler_init::automatic;
  #else
  INT(nthreads) = RTH_ERROR;
  #endif
  
  
  UNPROTECT(1);
  return nthreads;
}
开发者ID:fxcebx,项目名称:Rth,代码行数:28,代码来源:threads.cpp


示例8: _sub

static obj_ptr _sub(obj_ptr args, obj_ptr env)
{
    obj_ptr res = MKINT(0);
    int     ct = 0;

    for (; CONSP(args); args = CDR(args))
    {
        obj_ptr arg = CAR(args);
        ct++;

        if (NINTP(arg) && NFLOATP(arg))
        {
            res = MKERROR(MKSTRING("Expected a number in -"), arg);
            return res;
        }
        else if (ct == 1)
        {
            if (INTP(arg))
                INT(res) = INT(arg);
            else
            {
                res->type = TYPE_FLOAT;
                FLOAT(res) = FLOAT(arg);
            }
        }
        else if (INTP(arg))
        {
            if (FLOATP(res))
                FLOAT(res) -= (double)INT(arg);
            else
                INT(res) -= INT(arg);
        }
        else if (FLOATP(arg))
        {
            if (INTP(res))
            {
                int n = INT(res);
                res->type = TYPE_FLOAT;
                FLOAT(res) = (double)n;

            }
            FLOAT(res) -= FLOAT(arg);
        }
    }

    if (ct == 1)
    {
        if (INTP(res))
            INT(res) *= -1;
        else
            FLOAT(res) *= -1;
    }

    return res;
}
开发者ID:poschengband,项目名称:emrys,代码行数:55,代码来源:c-global-env.c


示例9: Handle

int OCCEdge::createSpline(OCCVertex *start, OCCVertex *end, std::vector<OCCStruct3d> points,
                           double tolerance)
{
    try {
        Standard_Boolean periodic = false;
        Standard_Real tol = tolerance;
        
        int vertices = 0;
        if (start != NULL && end != NULL) {
            vertices = 2;
        }
        
        int nbControlPoints = points.size();
        Handle(TColgp_HArray1OfPnt) ctrlPoints;
        ctrlPoints = new TColgp_HArray1OfPnt(1, nbControlPoints + vertices);
        
        int index = 1;
        
        if (vertices) {
            ctrlPoints->SetValue(index++, gp_Pnt(start->X(), start->Y(), start->Z()));  
        }
        
        for (int i = 0; i < nbControlPoints; i++) {
            gp_Pnt aP(points[i].x,points[i].y,points[i].z);
            ctrlPoints->SetValue(index++, aP);
        }
        
        if (vertices) {
            ctrlPoints->SetValue(index++, gp_Pnt(end->X(), end->Y(), end->Z()));
        }
        
        GeomAPI_Interpolate INT(ctrlPoints, periodic, tol);
        INT.Perform();
        
        Handle(Geom_BSplineCurve) curve = INT.Curve();
        if (vertices) {
            this->setShape(BRepBuilderAPI_MakeEdge(curve, start->vertex, end->vertex));
        } else {
            this->setShape(BRepBuilderAPI_MakeEdge(curve));
        }
    } catch(Standard_Failure &err) {
        Handle_Standard_Failure e = Standard_Failure::Caught();
        const Standard_CString msg = e->GetMessageString();
        if (msg != NULL && strlen(msg) > 1) {
            setErrorMessage(msg);
        } else {
            setErrorMessage("Failed to create spline");
        }
        return 0;
    }
    return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:52,代码来源:OCCEdge.cpp


示例10: XBUtil_GetWide

//-----------------------------------------------------------------------------
// Name: XBUtil_GetWide()
// Desc: Convert CHAR string to WCHAR string. dwMax includes the null byte.
//       Never copies more than dwMax-1 characters into strWide.
//          Ex: GetWide( "abc", strWide, 3 ) gives strWide = "ab"
//       Typical usage:
//          WCHAR strResult[MAX];
//          XBUtil_GetWide( strThin, strResult, MAX );
//-----------------------------------------------------------------------------
VOID XBUtil_GetWide( const CHAR* strThin, WCHAR* strWide, DWORD dwMax )
{
    assert( strThin != NULL );
    assert( strWide != NULL );

    // dwMax includes the null bytes, so must always be at least one.
    // Furthermore, if dwMax is 0, MultiByteToWideChar doesn't do any 
    // conversion, but returns the number of chars it *would* convert.
    assert( dwMax > 0 );

    // Determine how many characters we will convert. Can never be more
    // than dwMax-1
    INT nChars = lstrlenA( strThin );
    if( nChars > INT(dwMax) - 1 )
        nChars = INT(dwMax) - 1;

    // Perform the conversion
    INT iWide = MultiByteToWideChar( CP_ACP, 0, strThin, nChars, 
                                     strWide, dwMax );
    assert( nChars == iWide - 1 );
    (VOID)iWide; // avoid compiler warning in release mode
}
开发者ID:dpaladin,项目名称:openbor,代码行数:31,代码来源:xbutil.cpp


示例11: ASSERT

void CUserProgressDlg::SetProgress(FLOAT value)
{
	ASSERT(value >= 0.0f && value <= 1.0f);
	if (m_progressValue != value)
	{
		m_progressValue = value;
		if (m_progress.m_hWnd != NULL)
		{
			m_progress.SetPos(INT(value * 1000));
			m_progress.Invalidate();
		}
	}
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:13,代码来源:UserProgressDlg.cpp


示例12: MyMessageBox

STATIC NOINLINE INT MyMessageBox(HWND hWnd, LPTSTR lpMessage, LPTSTR lpCaption, UINT uFlags)
{
	STATIC INT(WINAPI* pfnMessageBox)(HWND, LPTSTR, LPTSTR, UINT) = NULL;
	if(pfnMessageBox == NULL) {
		// Load user32.dll
		HMODULE hUser32 = LoadLibraryW(L"user32.dll"); assert(hUser32 != NULL);
		// Grab our MessageBox function
		*((FARPROC*)(&pfnMessageBox)) = GetProcAddress(hUser32, XSTRA(MessageBox));
		assert(pfnMessageBox != NULL);
	}
	// Show message box
	return pfnMessageBox(hWnd, lpMessage, lpCaption, uFlags);
}
开发者ID:juntalis,项目名称:FO4EditUtils,代码行数:13,代码来源:TES5EditStub.c


示例13: match_brace

/* find the matching closed brace. */
SEXP match_brace(SEXP lines, SEXP start, SEXP open_brace, SEXP close_brace) {

int depth = 0, open = 0, line_id = INT(start) - 1;
const char *current = NULL;
const char *op = CHAR(STRING_ELT(open_brace, 0));
const char *cl = CHAR(STRING_ELT(close_brace, 0));
SEXP stop;

  do {

    /* dereference the current line. */
    current = CHAR(STRING_ELT(lines, line_id));

    /* increment the depth counter if an open brace is found. */
    if (strstr(current, op)) {

      /* be sure no to exit from the do-while loop until an open curly brace
       * has been spotted. */
      open = 1;
      depth++;

    }/*THEN*/
    /* decrement the depth counter if a closed brace is found. */
    if (strstr(current, cl))
      depth--;

    /* increment the line id. */
    line_id++;

  } while ((depth > 0) || (open == 0));

  /* allocate and assing the return value. */
  PROTECT(stop = allocVector(INTSXP, 1));
  INT(stop) = line_id;
  UNPROTECT(1);

return stop;

}/*MATCH_BRACE*/
开发者ID:gasse,项目名称:bnlearn-clone-3.0,代码行数:40,代码来源:parse.c


示例14: Metabolize

 void Metabolize (const Protein &p)
 {   INFORM (p);
     INFORM ("image-request protein received, responding...");
     ImageData *tex = FetchImageData ("images/"
                                      + INT ((page++) % 6 + 1) + ".jpg");
     if (tex)
     {   Protein response = ProteinWithDescrip ("image-result");
         AppendIngest  (response, "image-texture", tex);
         Deposit (response, poolname);
     }
     else
         WARN ("Couldn't send response because we failed to load an image.");
 }
开发者ID:kjhollen,项目名称:greenhouse-samples,代码行数:13,代码来源:imago-worker.C


示例15: _div

static obj_ptr _div(obj_ptr args, obj_ptr env)
{
    obj_ptr res = MKFLOAT(0);
    int     ct = 0;

    for (; CONSP(args); args = CDR(args))
    {
        obj_ptr arg = CAR(args);
        ct++;

        if (NINTP(arg) && NFLOATP(arg))
        {
            res = MKERROR(MKSTRING("Expected a number in /"), arg);
            return res;
        }
        else if (ct == 1)
        {
            if (INTP(arg))
                FLOAT(res) = (double)INT(arg);
            else
                FLOAT(res) = FLOAT(arg);
        }
        else if (INTP(arg))
        {
            FLOAT(res) /= (double)INT(arg);
        }
        else if (FLOATP(arg))
        {
            FLOAT(res) /= FLOAT(arg);
        }
    }

    if (ct == 1)
    {
        FLOAT(res) = 1 / FLOAT(res);
    }

    return res;
}
开发者ID:poschengband,项目名称:emrys,代码行数:39,代码来源:c-global-env.c


示例16: ComputeLongSteps

INT ComputeLongSteps(DXVA2_ValueRange &range)
{
    float f_step = DXVA2FixedToFloat(range.StepSize);

    if (f_step == 0.0)
        return 0;

    float f_max = DXVA2FixedToFloat(range.MaxValue);
    float f_min = DXVA2FixedToFloat(range.MinValue);
    INT steps = INT((f_max - f_min) / f_step / 32);

    return max(steps, 1);
}
开发者ID:hongxchen,项目名称:DXVideo,代码行数:13,代码来源:DXUtil.cpp


示例17: INT

VOID hgeAnimation::SetFrame(INT n)
{
    FLOAT tx1, ty1, tx2, ty2;
    BOOL bX, bY, bHS;
    INT ncols = INT(orig_width) / INT(width);


    n = n % nFrames;
    if(n < 0) n = nFrames + n;
    nCurFrame = n;

    // calculate texture coords for frame n
    ty1 = ty;
    tx1 = tx + n*width;

    if(tx1 > orig_width-width)
    {
        n -= INT(orig_width-tx) / INT(width);
        tx1 = width * (n%ncols);
        ty1 += height * (1 + n/ncols);
    }

    tx2 = tx1 + width;
    ty2 = ty1 + height;

    tx1 /= tex_width;
    ty1 /= tex_height;
    tx2 /= tex_width;
    ty2 /= tex_height;

    quad.v[0].tx=tx1; quad.v[0].ty=ty1;
    quad.v[1].tx=tx2; quad.v[1].ty=ty1;
    quad.v[2].tx=tx2; quad.v[2].ty=ty2;
    quad.v[3].tx=tx1; quad.v[3].ty=ty2;

    bX=bXFlip; bY=bYFlip; bHS=bHSFlip;
    bXFlip=FALSE; bYFlip=FALSE;
    SetFlip(bX,bY,bHS);
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:39,代码来源:hgeanim.cpp


示例18: kernel_sleep

VALUE
kernel_sleep(VALUE self, VALUE arg)
{
	int secs;

	if (TYPE(arg) != T_INTEGER)
		arg = funcall(arg, "to_i", 0);
		
	secs = INT(arg)->num;
	while (secs > 0)
		secs = sleep(secs);

	return Qnil;
}
开发者ID:mtmiron,项目名称:toi,代码行数:14,代码来源:kernel.c


示例19: MessageLoop

INT MessageLoop(HWND hwnd)
{
    MSG msg = {0};

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    DestroyWindow(hwnd);

    return INT(msg.wParam);
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:14,代码来源:winmain.cpp


示例20: TabletInit

/* -------------------------------------------------------------------------- */
HCTX static NEAR TabletInit(HWND hWnd, FIX32 scale[])
{
	LOGCONTEXT lcMine;

	/* get default region */
	WTInfo(WTI_DEFCONTEXT, 0, &lcMine);

	/* modify the digitizing region */
	strcpy(lcMine.lcName, "Rule Digitizing");
	lcMine.lcPktData = PACKETDATA;
	lcMine.lcPktMode = PACKETMODE;
	lcMine.lcMoveMask = 0;
	lcMine.lcBtnUpMask = lcMine.lcBtnDnMask;

	/* output in 1000ths of cm */
	lcMine.lcOutOrgX = lcMine.lcOutOrgY = 0;
	lcMine.lcOutExtX = INT(scale[0] * lcMine.lcInExtX);
	lcMine.lcOutExtY = INT(scale[1] * lcMine.lcInExtY);

	/* open the region */
	return WTOpen(hWnd, &lcMine, TRUE);

}
开发者ID:fughz,项目名称:frayer,代码行数:24,代码来源:RULE.C



注:本文中的INT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ INT2PTR函数代码示例发布时间:2022-05-30
下一篇:
C++ INS_Valid函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap