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

C++ special函数代码示例

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

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



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

示例1: socialServerStart

bool socialServerStart(SocialServer *self) {
    special("======================");
    special("==== Social server ===");
    special("======================");

    if (!(serverStart(self->server))) {
        error("Cannot start the Server.");
        return false;
    }

    return true;
}
开发者ID:Smallthing,项目名称:R1EMU,代码行数:12,代码来源:social_server.c


示例2: main

int
main (int argc, char *argv[])
{
  tests_start_mpfr ();

  special ();

  test_specialz (mpfr_add_z, mpz_add, "add");
  test_specialz (mpfr_sub_z, mpz_sub, "sub");
  test_specialz (mpfr_mul_z, mpz_mul, "mul");
  test_genericz (2, 100, 100, mpfr_add_z, "add");
  test_genericz (2, 100, 100, mpfr_sub_z, "sub");
  test_genericz (2, 100, 100, mpfr_mul_z, "mul");
  test_genericz (2, 100, 100, mpfr_div_z, "div");

  test_genericq (2, 100, 100, mpfr_add_q, "add");
  test_genericq (2, 100, 100, mpfr_sub_q, "sub");
  test_genericq (2, 100, 100, mpfr_mul_q, "mul");
  test_genericq (2, 100, 100, mpfr_div_q, "div");
  test_specialq (2, 100, 100, mpfr_mul_q, mpq_mul, "mul");
  test_specialq (2, 100, 100, mpfr_div_q, mpq_div, "div");
  test_specialq (2, 100, 100, mpfr_add_q, mpq_add, "add");
  test_specialq (2, 100, 100, mpfr_sub_q, mpq_sub, "sub");

  test_cmp_z (2, 100, 100);
  test_cmp_q (2, 100, 100);
  test_cmp_f (2, 100, 100);

  check_for_zero ();

  tests_end_mpfr ();
  return 0;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:33,代码来源:tgmpop.c


示例3: main

int
main(int argc, char *argv[])
{
	int *pr_arr, pr_len, n_found;
	int max = 1;  /* max number of prime search. this grows '*10' */
	int i, tmp;
	long sum;

	n_found = 0;
	sum = 0L;
	tmp = 4;  /* for skip 2,3,5,7 */

	while (1) {
		/* we grow search range to 10,100,1000.. */
		max *= 10;
		if (primes_under(max, &pr_arr, &pr_len))
			errx(1, "fail primes_under(%d)", max);
		for (i = tmp; i < pr_len; i++) {
			if (special(pr_arr[i], pr_arr, pr_len)) {
				sum += pr_arr[i];
				n_found++;
				if (n_found == NEED_NFOUND)
					break;  /* out to for-loop */
			}
		}
		if (n_found == NEED_NFOUND)
			break;  /* out to while-loop */
		tmp = pr_len;  /* skip already checked for next loop */
		free(pr_arr);
	}
	printf("%ld\n", sum);
	return 0;
}
开发者ID:tachama,项目名称:project-euler,代码行数:33,代码来源:pr037.c


示例4: main

int
main (int argc, char **argv)
{
  mpfr_t x;

  tests_start_mpfr ();

  special ();

  check_inexact ();

  check("1.0", 3, MPFR_RNDN, "3.3333333333333331483e-1");
  check("1.0", 3, MPFR_RNDZ, "3.3333333333333331483e-1");
  check("1.0", 3, MPFR_RNDU, "3.3333333333333337034e-1");
  check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1");
  check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7");
  check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087");

  mpfr_init2 (x, 53);
  mpfr_set_ui (x, 3, MPFR_RNDD);
  mpfr_log (x, x, MPFR_RNDD);
  mpfr_div_ui (x, x, 5, MPFR_RNDD);
  if (mpfr_cmp_str1 (x, "0.21972245773362189536"))
    {
      printf ("Error in mpfr_div_ui for x=ln(3), u=5\n");
      exit (1);
    }
  mpfr_clear (x);

  test_generic_ui (2, 200, 100);

  tests_end_mpfr ();
  return 0;
}
开发者ID:Kirija,项目名称:XPIR,代码行数:34,代码来源:tdiv_ui.c


示例5: fillstruct

glui32 fillstruct(strid_t stream, const unsigned *info, glui32 *dest,
		  glui32 (*special)(strid_t))
{
  unsigned char buffer[4];
  unsigned e;
  glui32 len = 0;;

  for(e = 0; info[e]; e++) {
    if(info[e] == 0x8000) {
      *dest++ = special(stream);
      len++;
    }
    else if(info[e] > 4) {
      unsigned i;
      for(i = 0; i < info[e]; i++) {
	*dest++ = glk_get_char_stream(stream);
	len++;
      }
    } else {
      glk_get_buffer_stream(stream, (char *) buffer, info[e]);

      switch(info[e]) {
      case 1: *dest = MSBdecode1(buffer); break;
      case 2: *dest = MSBdecode2(buffer); break;
      case 3: *dest = MSBdecode3(buffer); break;
      case 4: *dest = MSBdecode4(buffer); break;
      }
      dest++;
      len+=info[e];
    }
  }
  return len;
}
开发者ID:BPaden,项目名称:garglk,代码行数:33,代码来源:struct.c


示例6: assert

ReservedSpace
ReservedSpace::last_part(size_t partition_size, size_t alignment) {
  assert(partition_size <= size(), "partition failed");
  ReservedSpace result(base() + partition_size, size() - partition_size,
                       alignment, special(), executable());
  return result;
}
开发者ID:stkaushal,项目名称:jdk8_tl,代码行数:7,代码来源:virtualspace.cpp


示例7:

//! This function is called once per simulation step, allowing the
//! constraint to be "motorized" according to some response.
void OscHinge2ODE::simulationCallback()
{
    ODEConstraint& me = *static_cast<ODEConstraint*>(special());

    dReal angle1 = dJointGetHinge2Angle1(me.joint());
    dReal rate1 = dJointGetHinge2Angle1Rate(me.joint());

    dReal addtorque1 =
        - m_response->m_stiffness.m_value*angle1
        - m_response->m_damping.m_value*rate1;

#if 0  // TODO: dJointGetHinge2Angle2 is not yet available in ODE.
    dReal angle2 = dJointGetHinge2Angle2(me.joint());
#else
    dReal angle2 = 0;
#endif
    dReal rate2 = dJointGetHinge2Angle2Rate(me.joint());

    dReal addtorque2 =
        - m_response->m_stiffness.m_value*angle2
        - m_response->m_damping.m_value*rate2;

    m_torque1.m_value = addtorque1;
    m_torque2.m_value = addtorque2;

    dJointAddHinge2Torques(me.joint(), addtorque1, addtorque2);
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:29,代码来源:PhysicsSim.cpp


示例8: simulationCallback

void OscFreeODE::simulationCallback()
{
    ODEConstraint& me = *static_cast<ODEConstraint*>(special());

    const dReal *pos1 = dBodyGetPosition(me.body1());
    const dReal *pos2 = dBodyGetPosition(me.body2());

    const dReal *vel1 = dBodyGetLinearVel(me.body1());
    const dReal *vel2 = dBodyGetLinearVel(me.body2());

    dReal force[3];

    force[0] =
        - ((pos2[0]-pos1[0]-m_initial_distance[0])
           * m_response->m_stiffness.m_value)
        - (vel2[0]-vel1[0]) * m_response->m_damping.m_value;

    force[1] =
        - ((pos2[1]-pos1[1]-m_initial_distance[1])
           * m_response->m_stiffness.m_value)
        - (vel2[1]-vel1[1]) * m_response->m_damping.m_value;

    force[2] =
        - ((pos2[2]-pos1[2]-m_initial_distance[2])
           * m_response->m_stiffness.m_value)
        - (vel2[2]-vel1[2]) * m_response->m_damping.m_value;

    dBodyAddForce(me.body1(), -force[0], -force[1], -force[2]);
    dBodyAddForce(me.body2(),  force[0],  force[1],  force[2]);
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:30,代码来源:PhysicsSim.cpp


示例9: main

int
main (void)
{
    mp_prec_t p;

    MPFR_TEST_USE_RANDS ();
    tests_start_mpfr ();

    special ();
    particular_cases ();
    check_pow_ui ();
    check_pow_si ();
    check_special_pow_si ();
    pow_si_long_min ();
    for (p = 2; p < 100; p++)
        check_inexact (p);
    underflows ();
    overflows ();
    x_near_one ();

    test_generic (2, 100, 100);
    test_generic_ui (2, 100, 100);
    test_generic_si (2, 100, 100);

    data_check ("data/pow275", mpfr_pow275, "mpfr_pow275");

    tests_end_mpfr ();
    return 0;
}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:tpow.c


示例10: actual_committed_size

size_t VirtualSpace::actual_committed_size() const {
  // Special VirtualSpaces commit all reserved space up front.
  if (special()) {
    return reserved_size();
  }

  size_t committed_low    = pointer_delta(_lower_high,  _low_boundary,         sizeof(char));
  size_t committed_middle = pointer_delta(_middle_high, _lower_high_boundary,  sizeof(char));
  size_t committed_high   = pointer_delta(_upper_high,  _middle_high_boundary, sizeof(char));

#ifdef ASSERT
  size_t lower  = pointer_delta(_lower_high_boundary,  _low_boundary,         sizeof(char));
  size_t middle = pointer_delta(_middle_high_boundary, _lower_high_boundary,  sizeof(char));
  size_t upper  = pointer_delta(_upper_high_boundary,  _middle_high_boundary, sizeof(char));

  if (committed_high > 0) {
    assert(committed_low == lower, "Must be");
    assert(committed_middle == middle, "Must be");
  }

  if (committed_middle > 0) {
    assert(committed_low == lower, "Must be");
  }
  if (committed_middle < middle) {
    assert(committed_high == 0, "Must be");
  }

  if (committed_low < lower) {
    assert(committed_high == 0, "Must be");
    assert(committed_middle == 0, "Must be");
  }
#endif

  return committed_low + committed_middle + committed_high;
}
开发者ID:mur47x111,项目名称:JDK8-concurrent-tagging,代码行数:35,代码来源:virtualspace.cpp


示例11: assert

size_t PSVirtualSpaceHighToLow::expand_into(PSVirtualSpace* other_space,
                                            size_t bytes) {
  assert(is_aligned(bytes), "arg not aligned");
  assert(grows_down(), "this space must grow down");
  assert(other_space->grows_up(), "other space must grow up");
  assert(reserved_low_addr() == other_space->reserved_high_addr(),
         "spaces not contiguous");
  assert(special() == other_space->special(), "one space is special in memory, the other is not");
  DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
  DEBUG_ONLY(PSVirtualSpaceVerifier other_verifier(other_space));

  size_t bytes_needed = bytes;

  // First use the uncommitted region in this space.
  size_t tmp_bytes = MIN2(uncommitted_size(), bytes_needed);
  if (tmp_bytes > 0) {
    if (expand_by(tmp_bytes)) {
      bytes_needed -= tmp_bytes;
    } else {
      return 0;
    }
  }

  // Next take from the uncommitted region in the other space, and commit it.
  tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed);
  if (tmp_bytes > 0) {
    char* const commit_base = committed_low_addr() - tmp_bytes;
    if (other_space->special() ||
        os::commit_memory(commit_base, tmp_bytes, alignment(), !ExecMem)) {
      // Reduce the reserved region in the other space.
      other_space->set_reserved(other_space->reserved_low_addr(),
                                other_space->reserved_high_addr() - tmp_bytes,
                                other_space->special());

      // Grow both reserved and committed in this space.
      _reserved_low_addr -= tmp_bytes;
      _committed_low_addr -= tmp_bytes;
      bytes_needed -= tmp_bytes;
    } else {
      return bytes - bytes_needed;
    }
  }

  // Finally take from the already committed region in the other space.
  tmp_bytes = bytes_needed;
  if (tmp_bytes > 0) {
    // Reduce both committed and reserved in the other space.
    other_space->set_committed(other_space->committed_low_addr(),
                               other_space->committed_high_addr() - tmp_bytes);
    other_space->set_reserved(other_space->reserved_low_addr(),
                              other_space->reserved_high_addr() - tmp_bytes,
                              other_space->special());

    // Grow both reserved and committed in this space.
    _reserved_low_addr -= tmp_bytes;
    _committed_low_addr -= tmp_bytes;
  }

  return bytes;
}
开发者ID:shelan,项目名称:jdk9-mirror,代码行数:60,代码来源:psVirtualspace.cpp


示例12: OscFree

OscFreeODE::OscFreeODE(dWorldID odeWorld, dSpaceID odeSpace,
                         const char *name, OscBase* parent,
                         OscObject *object1, OscObject *object2)
    : OscFree(name, parent, object1, object2)
{
    m_response = new OscResponse("response",this);

    // The "Free" constraint is not actually an ODE constraint.
    // However, we need an ODEConstraint to remember the objects so
    // that they can receive forces and torques.

    m_pSpecial = new ODEConstraint(this, NULL, odeWorld, odeSpace,
                                   object1, object2);

    ODEConstraint& cons = *static_cast<ODEConstraint*>(special());
    const dReal *pos1 = dBodyGetPosition(cons.body1());
    const dReal *pos2 = dBodyGetPosition(cons.body2());

    m_initial_distance[0] = pos2[0] - pos1[0];
    m_initial_distance[1] = pos2[1] - pos1[1];
    m_initial_distance[2] = pos2[2] - pos1[2];

    printf("[%s] Free constraint created between %s and %s.\n",
           simulation()->type_str(),
           object1->c_name(), object2->c_name());
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:26,代码来源:PhysicsSim.cpp


示例13: main

int main(int argc, char ** argv){
	int option = -1;
	if( argc <= 1 || ( (option = atoi(argv[1])) < 0 ) ){
		print_usage();
	}
	int count = 0;
	if(argc >= 3)
		count = atoi(argv[2]);
	printf("Welcome to effectTest, option %d, count %d\n", option, count);
	switch(option){
		case 0:
			functional(count);
			break;
		case 1:
			left();
			break;
		case 2:
			right();
			break;
		case 3:
			duplicate();
			break;
		case 4:	
			invalid();
			break;
		case 5:
			special();
			break;
		case 9:
			other();
			break;
	}
	return 0;
}
开发者ID:movingname,项目名称:cruiser-psu,代码行数:34,代码来源:effectTest.cpp


示例14: on_density

void OscSphereODE::on_density()
{
    ODEObject *ode_object = static_cast<ODEObject*>(special());
    dMassSetSphere(&ode_object->mass(), m_density.m_value, m_radius.m_value);
    dBodySetMass(ode_object->body(), &ode_object->mass());

    m_mass.m_value = ode_object->mass().mass;
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:8,代码来源:PhysicsSim.cpp


示例15:

void G1PageBasedVirtualSpace::print_on(outputStream* out) {
  out->print   ("Virtual space:");
  if (special()) out->print(" (pinned in memory)");
  out->cr();
  out->print_cr(" - committed: " SIZE_FORMAT, committed_size());
  out->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
  out->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  p2i(_low_boundary), p2i(_high_boundary));
}
开发者ID:koutheir,项目名称:incinerator-hotspot,代码行数:8,代码来源:g1PageBasedVirtualSpace.cpp


示例16: menu

void
menu(int value)
{
  if(value < 0)
    special(-value, 0, 0);
  else
    key((unsigned char) value, 0, 0);
}
开发者ID:AlexGreulich,项目名称:HRTFVR,代码行数:8,代码来源:warp.c


示例17: testSpecial

void testSpecial() {
	int x = 10;
	for ( int i = 1; i < x; i+=2 ) {
		special( i );
	}


}
开发者ID:MrLi008,项目名称:visualstudio2013_,代码行数:8,代码来源:declarefunctions.cpp


示例18: print

void VirtualSpace::print() {
  tty->print   ("Virtual space:");
  if (special()) tty->print(" (pinned in memory)");
  tty->cr();
  tty->print_cr(" - committed: " SIZE_FORMAT, committed_size());
  tty->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
  tty->print_cr(" - [low, high]:     [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low(), high());
  tty->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low_boundary(), high_boundary());
}
开发者ID:stkaushal,项目名称:jdk8_tl,代码行数:9,代码来源:virtualspace.cpp


示例19: on_mass

void OscSphereODE::on_mass()
{
    ODEObject *ode_object = static_cast<ODEObject*>(special());
    dMassSetSphereTotal(&ode_object->mass(), m_mass.m_value, m_radius.m_value);
    dBodySetMass(ode_object->body(), &ode_object->mass());

    dReal volume = 4*M_PI*m_radius.m_value*m_radius.m_value*m_radius.m_value/3;
    m_density.m_value = m_mass.m_value / volume;
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:9,代码来源:PhysicsSim.cpp


示例20: on_radius

void OscSphereODE::on_radius()
{
    ODEObject *ode_object = static_cast<ODEObject*>(special());
    dGeomSphereSetRadius(ode_object->geom(), m_radius.m_value);

    // reset the mass to maintain same density
    dMassSetSphere(&ode_object->mass(), m_density.m_value, m_radius.m_value);

    m_mass.m_value = ode_object->mass().mass;
}
开发者ID:funkmeisterb,项目名称:dimple,代码行数:10,代码来源:PhysicsSim.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ special_file函数代码示例发布时间:2022-05-30
下一篇:
C++ spawnvp函数代码示例发布时间: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