当前位置: 首页>>代码示例>>C++>>正文


C++ read_buffer函数代码示例

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


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

示例1: main

int main(int argc, char const *argv[])
{
        /* Get platform */
        cl_platform_id platform;
        cl_uint num_platforms;
        cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clGetPlatformIDs' failed\n");
                exit(1);
        }
        
        printf("Number of platforms: %d\n", num_platforms);
        printf("platform=%p\n", platform);
        
        /* Get platform name */
        char platform_name[100];
        ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clGetPlatformInfo' failed\n");
                exit(1);
        }
        
        printf("platform.name='%s'\n\n", platform_name);
        
        /* Get device */
        cl_device_id device;
        cl_uint num_devices;
        ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clGetDeviceIDs' failed\n");
                exit(1);
        }
        
        printf("Number of devices: %d\n", num_devices);
        printf("device=%p\n", device);
        
        /* Get device name */
        char device_name[100];
        ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
        device_name, NULL);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clGetDeviceInfo' failed\n");
                exit(1);
        }
        
        printf("device.name='%s'\n", device_name);
        printf("\n");
        
        /* Create a Context Object */
        cl_context context;
        context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clCreateContext' failed\n");
                exit(1);
        }
        
        printf("context=%p\n", context);
        
        /* Create a Command Queue Object*/
        cl_command_queue command_queue;
        command_queue = clCreateCommandQueue(context, device, 0, &ret);
        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clCreateCommandQueue' failed\n");
                exit(1);
        }
        
        printf("command_queue=%p\n", command_queue);
        printf("\n");

        /* Program source */
        unsigned char *source_code;
        size_t source_length;

        /* Read program from 'relational_greater_than_uchar4uchar4.cl' */
        source_code = read_buffer("relational_greater_than_uchar4uchar4.cl", &source_length);

        /* Create a program */
        cl_program program;
        program = clCreateProgramWithSource(context, 1, (const char **)&source_code, &source_length, &ret);

        if (ret != CL_SUCCESS)
        {
                printf("error: call to 'clCreateProgramWithSource' failed\n");
                exit(1);
        }
        printf("program=%p\n", program);

        /* Build program */
        ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
        if (ret != CL_SUCCESS )
        {
                size_t size;
                char *log;

//.........这里部分代码省略.........
开发者ID:xianggong,项目名称:m2c-llvm-devtools-host,代码行数:101,代码来源:relational_greater_than_uchar4uchar4_src.c

示例2: run_Pitch

void
run_Pitch(LV2_Handle Instance,
        uint32_t SampleCount) {

    Pitch * ptr = (Pitch *)Instance;
    float * input = ptr->input;
    float * output = ptr->output;
    float drylevel = db2lin(LIMIT(*(ptr->drylevel),-90.0f,20.0f));
    float wetlevel = 0.333333f * db2lin(LIMIT(*(ptr->wetlevel),-90.0f,20.0f));
    float buflen = ptr->buflen / 2.0f;
    float semitone = LIMIT(*(ptr->semitone),-12.0f,12.0f);
    float rate;
    float r;
    float depth;

    unsigned long sample_index;
    unsigned long sample_count = SampleCount;

    float in = 0.0f;
    float sign = 1.0f;
    float phase_0 = 0.0f;
    float phase_am_0 = 0.0f;
    float phase_1 = 0.0f;
    float phase_am_1 = 0.0f;
    float phase_2 = 0.0f;
    float phase_am_2 = 0.0f;
    float fpos_0 = 0.0f, fpos_1 = 0.0f, fpos_2 = 0.0f;
    float n_0 = 0.0f, n_1 = 0.0f, n_2 = 0.0f;
    float rem_0 = 0.0f, rem_1 = 0.0f, rem_2 = 0.0f;
    float sa_0, sb_0, sa_1, sb_1, sa_2, sb_2;


    if (semitone == 0.0f)
        rate = LIMIT(*(ptr->rate),-50.0f,100.0f);
    else
        rate = 100.0f * (powf(ROOT_12_2,semitone) - 1.0f);

    r = -1.0f * ABS(rate);
    depth = buflen * LIMIT(ABS(r) / 100.0f, 0.0f, 1.0f);


    if (rate > 0.0f)
        sign = -1.0f;

    for (sample_index = 0; sample_index < sample_count; sample_index++) {

        in = *(input++);

        phase_0 = COS_TABLE_SIZE * PM_FREQ * sample_index / ptr->sample_rate + ptr->phase;
        while (phase_0 >= COS_TABLE_SIZE)
                phase_0 -= COS_TABLE_SIZE;
        phase_am_0 = phase_0 + COS_TABLE_SIZE/2;
        while (phase_am_0 >= COS_TABLE_SIZE)
            phase_am_0 -= COS_TABLE_SIZE;

        phase_1 = phase_0 + COS_TABLE_SIZE/3.0f;
        while (phase_1 >= COS_TABLE_SIZE)
                phase_1 -= COS_TABLE_SIZE;
        phase_am_1 = phase_1 + COS_TABLE_SIZE/2;
        while (phase_am_1 >= COS_TABLE_SIZE)
            phase_am_1 -= COS_TABLE_SIZE;

        phase_2 = phase_0 + 2.0f*COS_TABLE_SIZE/3.0f;
        while (phase_2 >= COS_TABLE_SIZE)
                phase_2 -= COS_TABLE_SIZE;
        phase_am_2 = phase_2 + COS_TABLE_SIZE/2;
        while (phase_am_2 >= COS_TABLE_SIZE)
            phase_am_2 -= COS_TABLE_SIZE;

        push_buffer(in, ptr->ringbuffer, ptr->buflen, &(ptr->pos));

        fpos_0 = depth * (1.0f - sign * (2.0f * phase_0 / COS_TABLE_SIZE - 1.0f));
        n_0 = floorf(fpos_0);
        rem_0 = fpos_0 - n_0;

        fpos_1 = depth * (1.0f - sign * (2.0f * phase_1 / COS_TABLE_SIZE - 1.0f));
        n_1 = floorf(fpos_1);
        rem_1 = fpos_1 - n_1;

        fpos_2 = depth * (1.0f - sign * (2.0f * phase_2 / COS_TABLE_SIZE - 1.0f));
        n_2 = floorf(fpos_2);
        rem_2 = fpos_2 - n_2;

        sa_0 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_0);
        sb_0 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_0 + 1);

        sa_1 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_1);
        sb_1 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_1 + 1);

        sa_2 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_2);
        sb_2 = read_buffer(ptr->ringbuffer, ptr->buflen, ptr->pos, (unsigned long) n_2 + 1);

        *(output++) =
            wetlevel *
            ((1.0f + cos_table[(unsigned long) phase_am_0]) *
             ((1 - rem_0) * sa_0 + rem_0 * sb_0) +
             (1.0f + cos_table[(unsigned long) phase_am_1]) *
             ((1 - rem_1) * sa_1 + rem_1 * sb_1) +
             (1.0f + cos_table[(unsigned long) phase_am_2]) *
             ((1 - rem_2) * sa_2 + rem_2 * sb_2)) +
//.........这里部分代码省略.........
开发者ID:NY-tram,项目名称:tap-lv2,代码行数:101,代码来源:tap_pitch.c

示例3: fetch_next_cert_ldap

/* Fetch the next certificate. Return 0 on success, GPG_ERR_EOF if no
   (more) certificates are available or any other error
   code. GPG_ERR_TRUNCATED may be returned to indicate that the result
   has been truncated. */
gpg_error_t
fetch_next_cert_ldap (cert_fetch_context_t context,
                      unsigned char **value, size_t *valuelen)
{
  gpg_error_t err;
  unsigned char hdr[5];
  char *p, *pend;
  unsigned long n;
  int okay = 0;
  /* int is_cms = 0; */

  *value = NULL;
  *valuelen = 0;

  err = 0;
  while (!err)
    {
      err = read_buffer (context->reader, hdr, 5);
      if (err)
        break;
      n = buf32_to_ulong (hdr+1);
      if (*hdr == 'V' && okay)
        {
#if 0  /* That code is not yet ready.  */

          if (is_cms)
            {
              /* The certificate needs to be parsed from CMS data. */
              ksba_cms_t cms;
              ksba_stop_reason_t stopreason;
              int i;

              err = ksba_cms_new (&cms);
              if (err)
                goto leave;
              err = ksba_cms_set_reader_writer (cms, context->reader, NULL);
              if (err)
                {
                  log_error ("ksba_cms_set_reader_writer failed: %s\n",
                             gpg_strerror (err));
                  goto leave;
                }

              do
                {
                  err = ksba_cms_parse (cms, &stopreason);
                  if (err)
                    {
                      log_error ("ksba_cms_parse failed: %s\n",
                                 gpg_strerror (err));
                      goto leave;
                    }

                  if (stopreason == KSBA_SR_BEGIN_DATA)
                    log_error ("userSMIMECertificate is not "
                               "a certs-only message\n");
                }
              while (stopreason != KSBA_SR_READY);

              for (i=0; (cert=ksba_cms_get_cert (cms, i)); i++)
                {
                  check_and_store (ctrl, stats, cert, 0);
                  ksba_cert_release (cert);
                  cert = NULL;
                }
              if (!i)
                log_error ("no certificate found\n");
              else
                any = 1;
            }
          else
#endif
            {
              *value = xtrymalloc (n);
              if (!*value)
                return gpg_error_from_errno (errno);
              *valuelen = n;
              err = read_buffer (context->reader, *value, n);
              break; /* Ready or error.  */
            }
        }
      else if (!n && *hdr == 'A')
        okay = 0;
      else if (n)
        {
          if (n > context->tmpbufsize)
            {
              xfree (context->tmpbuf);
              context->tmpbufsize = 0;
              context->tmpbuf = xtrymalloc (n+1);
              if (!context->tmpbuf)
                return gpg_error_from_errno (errno);
              context->tmpbufsize = n;
            }
          err = read_buffer (context->reader, context->tmpbuf, n);
          if (err)
//.........这里部分代码省略.........
开发者ID:gilbert-fernandes,项目名称:gnupg,代码行数:101,代码来源:ldap.c

示例4: read_stackstate

static glui32 read_stackstate(dest_t *dest, glui32 chunklen, int portable)
{
  glui32 res;
  glui32 frameend, frm, frm2, frm3, locpos, frlen, numlocals;

  if (chunklen > stacksize)
    return 1;

  stackptr = chunklen;
  frameptr = 0;
  valstackbase = 0;
  localsbase = 0;

  if (!portable) {
    res = read_buffer(dest, stack, stackptr);
    if (res)
      return res;
    return 0;
  }

  /* This isn't going to be pleasant; we're going to read the data in
     as a block, and then convert it in-place. */
  res = read_buffer(dest, stack, stackptr);
  if (res)
    return res;

  frameend = stackptr;
  while (frameend != 0) {
    /* Read the beginning-of-frame pointer. Remember, right now, the
       whole frame is stored big-endian. So we have to read with the
       Read*() macros, and then write with the StkW*() macros. */
    frm = Read4(stack+(frameend-4));

    frm2 = frm;

    frlen = Read4(stack+frm2);
    StkW4(frm2, frlen);
    frm2 += 4;
    locpos = Read4(stack+frm2);
    StkW4(frm2, locpos);
    frm2 += 4;

    /* The locals-format list is in bytes, so we don't have to convert it. */
    frm3 = frm2;
    frm2 = frm+locpos;

    numlocals = 0;

    while (1) {
      unsigned char loctype, loccount;
      loctype = Read1(stack+frm3);
      frm3 += 1;
      loccount = Read1(stack+frm3);
      frm3 += 1;

      if (loctype == 0 && loccount == 0)
        break;

      /* Skip up to 0, 1, or 3 bytes of padding, depending on loctype. */
      while (frm2 & (loctype-1)) {
        StkW1(frm2, 0);
        frm2++;
      }
      
      /* Convert this set of locals. */
      switch (loctype) {
        
      case 1:
        do {
          /* Don't need to convert bytes. */
          frm2 += 1;
          loccount--;
        } while (loccount);
        break;

      case 2:
        do {
          glui16 loc = Read2(stack+frm2);
          StkW2(frm2, loc);
          frm2 += 2;
          loccount--;
        } while (loccount);
        break;

      case 4:
        do {
          glui32 loc = Read4(stack+frm2);
          StkW4(frm2, loc);
          frm2 += 4;
          loccount--;
        } while (loccount);
        break;

      }

      numlocals++;
    }

    if ((numlocals & 1) == 0) {
      StkW1(frm3, 0);
//.........这里部分代码省略.........
开发者ID:abrobston,项目名称:glulxe,代码行数:101,代码来源:serial.c

示例5: read_buffer

int
Dump_Restore::populate (Dump_Restore::Operation_Type op)
{
  if (this->infile_)
    {
      int result = -1;
      enum State { NAME, VALUE, TYPE };

      State state = NAME;
      // reset file pointer
      ACE_OS::rewind (this->infile_);

      ACE_Allocator *allocator =
        ACE_Allocator::instance ();
      ACE_Read_Buffer read_buffer (this->infile_,
                                   0,
                                   allocator);

      for (char *temp;
           (temp = read_buffer.read ('\n')) != 0;
           )
        {
          char *name = 0;
          const char *actual_name = 0;
          char *value = 0;
          const char *actual_value = 0;
          char *type = 0;
          const char *actual_type = 0;

          switch (state)
            {
            case NAME:
              name = temp;
              ACE_OS::strtok (name, "=");
              actual_name = ACE_OS::strtok (0, "=");
              state = VALUE;
              break;
            case VALUE:
              value = temp;
              ACE_OS::strtok (value, "=");
              actual_value = ACE_OS::strtok (0, "=");
              state = TYPE;
              break;
            case TYPE:
              type = temp;
              ACE_OS::strtok (type, "=");
              actual_type = ACE_OS::strtok (0, "=");

              if (actual_type)
                result = this->doit (op,
                                     actual_name,
                                     actual_value,
                                     actual_type);
              else
                result = this->doit (op,
                                     actual_name,
                                     actual_value);
              if (name)
                allocator->free(name);
              if (value)
                allocator->free(value);
              if (type)
                allocator->free(type);
              state = NAME;
              break;
            default:
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("%p\n"),
                                 ACE_TEXT ("populate")),
                                -1);
              /* NOTREACHED */
            }
        }

      return result;
    }
  else
    return -1;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:79,代码来源:Dump_Restore.cpp

示例6: read_byte

static int read_byte(dest_t *dest, unsigned char *val)
{
  return read_buffer(dest, val, 1);
}
开发者ID:abrobston,项目名称:glulxe,代码行数:4,代码来源:serial.c

示例7: resize_cache

// This is called both during init and at runtime.
static int resize_cache(struct priv *s, int64_t size)
{
    int64_t min_size = FILL_LIMIT * 4;
    int64_t max_size = ((size_t)-1) / 4;
    int64_t buffer_size = MPMIN(MPMAX(size, min_size), max_size);

    unsigned char *buffer = malloc(buffer_size);
    struct byte_meta *bm = calloc(buffer_size / BYTE_META_CHUNK_SIZE + 2,
                                  sizeof(struct byte_meta));
    if (!buffer || !bm) {
        free(buffer);
        free(bm);
        return STREAM_ERROR;
    }

    if (s->buffer) {
        // Copy & free the old ringbuffer data.
        // If the buffer is too small, prefer to copy these regions:
        // 1. Data starting from read_filepos, until cache end
        size_t read_1 = read_buffer(s, buffer, buffer_size, s->read_filepos);
        // 2. then data from before read_filepos until cache start
        //    (this one needs to be copied to the end of the ringbuffer)
        size_t read_2 = 0;
        if (s->min_filepos < s->read_filepos) {
            size_t copy_len = buffer_size - read_1;
            copy_len = MPMIN(copy_len, s->read_filepos - s->min_filepos);
            assert(copy_len + read_1 <= buffer_size);
            read_2 = read_buffer(s, buffer + buffer_size - copy_len, copy_len,
                                 s->read_filepos - copy_len);
            // This shouldn't happen, unless copy_len was computed incorrectly.
            assert(read_2 == copy_len);
        }
        // Set it up such that read_1 is at buffer pos 0, and read_2 wraps
        // around below it, so that it is located at the end of the buffer.
        s->min_filepos = s->read_filepos - read_2;
        s->max_filepos = s->read_filepos + read_1;
        s->offset = s->max_filepos - read_1;
    } else {
        cache_drop_contents(s);
    }

    free(s->buffer);
    free(s->bm);

    s->buffer_size = buffer_size;
    s->back_size = buffer_size / 2;
    s->buffer = buffer;
    s->bm = bm;
    s->idle = false;
    s->eof = false;

    //make sure that we won't wait from cache_fill
    //more data than it is allowed to fill
    if (s->seek_limit > s->buffer_size - FILL_LIMIT)
        s->seek_limit = s->buffer_size - FILL_LIMIT;

    for (size_t n = 0; n < s->buffer_size / BYTE_META_CHUNK_SIZE + 2; n++)
        s->bm[n] = (struct byte_meta){.stream_pts = MP_NOPTS_VALUE};

    return STREAM_OK;
}
开发者ID:avbrychak,项目名称:mpv,代码行数:62,代码来源:cache.c

示例8: main


//.........这里部分代码省略.........
	if (ret != CL_SUCCESS)
	{
		printf("error: call to 'clCreateContext' failed\n");
		exit(1);
	}

	

	/*
	 * Command Queue
	 */
	
	/* Create command queue */
	cl_command_queue command_queue;
	command_queue = clCreateCommandQueue(context, device, 0, &ret);
	if (ret != CL_SUCCESS)
	{
		printf("error: call to 'clCreateCommandQueue' failed\n");
		exit(1);
	}
	printf("\n");



	/*
	 * Program
	 */
	
	/* Program binary */
	const unsigned char *binary;
	size_t binary_length;

	/* Read binary */
	binary = read_buffer(binary_path, &binary_length);
	if (!binary)
	{
		printf("error: %s: cannot open binary\n", binary_path);
		exit(1);
	}
	
	/* Create a program */
	cl_program program;
	program = clCreateProgramWithBinary(context, 1, &device, &binary_length,
			&binary, NULL, &ret);
	if (ret != CL_SUCCESS)
	{
		printf("error: call to 'clCreateProgramWithSource' failed\n");
		exit(1);
	}

	/* Build program */
	ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
	if (ret != CL_SUCCESS )
	{
		size_t size;
		char *log;

		/* Get log size */
		clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &size);

		/* Allocate log and print */
		log = malloc(size);
		clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, size, log, NULL);
		printf("error: call to 'clBuildProgram' failed:\n%s\n", log);

		/* Free log and exit */
开发者ID:multi2sim-upv,项目名称:multi2sim-tests,代码行数:67,代码来源:if.c

示例9: handle_send

static void handle_send(struct connect_s *conn, struct timeval *tv)
{
  httpd_conn *hc = conn->hc;
  int nwritten;
  int nread;

  /* Read until the entire file is sent -- this could take awhile!! */

  while (conn->offset < conn->end_offset)
    {
      ninfo("offset: %d end_offset: %d bytes_sent: %d\n",
            conn->offset, conn->end_offset, conn->hc->bytes_sent);

      /* Fill the rest of the response buffer with file data */

      nread = read_buffer(conn);
      if (nread < 0)
        {
          nerr("ERROR: File read error: %d\n", errno);
          goto errout_clear_connection;
        }
      ninfo("Read %d bytes, buflen %d\n", nread, hc->buflen);

      /* Send the buffer */

      if (hc->buflen > 0)
        {
          /* httpd_write does not return until all bytes have been sent
           * (or an error occurs).
           */

          nwritten = httpd_write(hc->conn_fd, hc->buffer, hc->buflen);
          if (nwritten < 0)
            {
              nerr("ERROR: Error sending %s: %d\n",
                   hc->encodedurl, errno);
              goto errout_clear_connection;
            }

          /* We wrote one full buffer of data (httpd_write does not
           * return until the full buffer is written (or an error occurs).
           */

          conn->active_at       = tv->tv_sec;
          hc->buflen            = 0;

          /* And update how much of the file we wrote */

          conn->offset         += nwritten;
          conn->hc->bytes_sent += nwritten;
          ninfo("Wrote %d bytes\n", nwritten);
        }
    }

  /* The file transfer is complete -- finish the connection */

  ninfo("Finish connection\n");
  finish_connection(conn, tv);
  return;

errout_clear_connection:
  ninfo("Clear connection\n");
  clear_connection(conn, tv);
  return;
}
开发者ID:hll4fork,项目名称:nuttx-apps,代码行数:65,代码来源:thttpd.c

示例10: readPRT


//.........这里部分代码省略.........
            }
#endif
            std::string name((char*)ch.name);
            ParticleAttribute attrHandle=simple->addAttribute(name.c_str(),type,ch.arity);
            chans.push_back(ch);
            attrs.push_back(attrHandle);
        }
        
        // The size of the particle is determined from the channel with largest offset. The channels are not required to be listed in order.
        particleSize = (std::max)( particleSize, chans.back().offset + sizes[ch.type] );
        
        // The channel entry might have more data in other PRT versions.
        if ((unsigned)channelsize > sizeof(Channel))
            input->seekg(channelsize - sizeof(Channel), std::ios::cur);
    }

    if (headersOnly) return simple;

    z_stream z;
    z.zalloc = Z_NULL;z.zfree = Z_NULL;z.opaque = Z_NULL;
    if (inflateInit( &z ) != Z_OK) {
        if(errorStream) *errorStream<<"Zlib inflateInit error"<<std::endl;
        return 0;
    }

    char in_buf[OUT_BUFSIZE];
    z.next_in = 0;
    z.avail_in = 0;
    
    char* prt_buf = new char[particleSize];

    for (unsigned int particleIndex=0;particleIndex<(unsigned int )simple->numParticles();particleIndex++) {
        // Read the particle from the file, and decompress it into a single particle-sized buffer.
        read_buffer(*input, z, (char*)in_buf, prt_buf, particleSize, errorStream);
        
        for (unsigned int attrIndex=0;attrIndex<attrs.size();attrIndex++) {
            if (attrs[attrIndex].type==Partio::INT) {
                int* data=simple->dataWrite<int>(attrs[attrIndex],particleIndex);
                for (int count=0;count<attrs[attrIndex].count;count++) {
                    int ival = 0;
                    switch (chans[attrIndex].type) {
                    case 0:	// int16
                        {
                            ival = (int)*reinterpret_cast<short*>( &prt_buf[ chans[attrIndex].offset + count * sizeof(short) ] );
                        }
                        break;
                    case 1:	// int32
                        {
                            ival = (int)*reinterpret_cast<int*>( &prt_buf[ chans[attrIndex].offset + count * sizeof(int) ] );
                        }
                        break;
                    case 2:	// int64
                        {
                            ival = (int)*reinterpret_cast<long long*>( &prt_buf[ chans[attrIndex].offset + count * sizeof(long long) ] );
                        }
                        break;
                    case 6:	// uint16
                        {
                            ival = (int)*reinterpret_cast<unsigned short*>( &prt_buf[ chans[attrIndex].offset + count * sizeof(unsigned short) ] );
                        }
                        break;
                    case 7:	// uint32
                        {
                            ival = (int)*reinterpret_cast<unsigned int*>( &prt_buf[ chans[attrIndex].offset +  + count * sizeof(unsigned int) ] );
                        }
                        break;
开发者ID:CallForSanity,项目名称:partio,代码行数:67,代码来源:PRT.cpp


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