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

C++ read_bit函数代码示例

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

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



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

示例1: getbuttonstate

int getbuttonstate()
{
	FILE *in;
	int ret;

#ifdef HAVE_STORM
	ret = read_bit(60);
#elif HAVE_WG302V1
	ret = read_bit(13);
#elif HAVE_WG302
	ret = read_bit(3);
#elif HAVE_MI424WR
	ret = read_bit(10);
#elif HAVE_USR8200
	ret = read_bit(12);
#elif HAVE_CAMBRIA
	if (isGW2350())
		ret = read_bit(4);
	else
		ret = read_bit(20);
#else
	if (isCompex())
		ret = read_bit(0);
	if (isGW2369())
		ret = read_bit(3);
	else
		ret = read_bit(4);
#endif
#ifdef HAVE_TONZE
	return ret == 0 ? 0 : 1;
#else
	return ret == 0 ? 1 : 0;
#endif
}
开发者ID:rogerhu,项目名称:dd-wrt,代码行数:34,代码来源:resetbutton.c


示例2: parse_pes

/*!
 * \brief Parse PES packet.
 * \param *bitstr: The bitstream to use.
 * \param *header: A pointer to a PES header structure.
 * \param *packet: A pointer to a PES packet structure.
 * \return 1 if succeed, 0 otherwise.
 *
 * From 'ISO/IEC 13818-1' specification:
 * 2.4.3.6 PES packet.
 * Table 2-17 – PES packet.
 *
 * Parse both MPEG-1 (ISO/IEC 11172-1) and MPEG-2 (ISO/IEC 13818-1) PES packets.
 */
int parse_pes(Bitstream_t *bitstr, PesHeader_t *header, PesPacket_t *packet)
{
    TRACE_2(MPS, "> parse_pes()");
    int retcode = SUCCESS;

    TRACE_INFO(MPS, "parse_pes() 0x%X @ %lli",
               header->start_code, bitstream_get_absolute_byte_offset(bitstr));

    // "regular" PES packet?
    if ((header->stream_id != SID_PROGRAM_STREAM_MAP) &&
        (header->stream_id != SID_PADDING) &&
        (header->stream_id != SID_PRIVATE_STREAM_2) &&
        (header->stream_id != SID_ECM_STREAM) &&
        (header->stream_id != SID_EMM_STREAM) &&
        (header->stream_id != SID_PROGRAM_STREAM_DIRECTORY) &&
        (header->stream_id != SID_DSMCC_STREAM) &&
        (header->stream_id != SID_2221E))
    {
        unsigned checkversion = next_bits(bitstr, 2);

        // Parse MPEG-2 PES header
        if ((checkversion & 0x02) == 0x02)
        {
            packet->mpeg_version = 2;

            if (read_bits(bitstr, 2) != 2)
            {
                TRACE_ERROR(MPS, "wrong 'marker_bits'");
                return FAILURE;
            }

            packet->PES_scrambling_control = read_bits(bitstr, 2);
            packet->PES_priority = read_bit(bitstr);
            packet->data_alignment_indicator = read_bit(bitstr);
            packet->copyright = read_bit(bitstr);
            packet->original_or_copy = read_bit(bitstr);
            packet->PTS_DTS_flag = read_bits(bitstr, 2);
            packet->ESCR_flag = read_bit(bitstr);
            packet->ES_rate_flag = read_bit(bitstr);
            packet->DSM_trick_mode_flag = read_bit(bitstr);
            packet->additional_copy_info_flag = read_bit(bitstr);
            packet->PES_CRC_flag = read_bit(bitstr);
            packet->PES_extension_flag = read_bit(bitstr);
            packet->PES_header_data_length = read_bits(bitstr, 8);

            if (packet->PTS_DTS_flag == 2)
            {
                if (read_bits(bitstr, 4) != 2)
                {
                    TRACE_ERROR(MPS, "wrong 'marker_bit'");
                    return FAILURE;
                }
                packet->PTS = read_bits(bitstr, 3) << 30;
                MARKER_BIT
                packet->PTS += read_bits(bitstr, 15) << 15;
                MARKER_BIT
                packet->PTS += read_bits(bitstr, 15);
                MARKER_BIT
            }
            else if (packet->PTS_DTS_flag == 3)
开发者ID:emericg,项目名称:MiniVideo,代码行数:73,代码来源:pes.cpp


示例3: read_chunk_regs

void read_chunk_regs(void *fptr, int action)
{
    struct user user;
    struct cp_sparc_window_regs or;
    int stopped;
    read_bit(fptr, &user, sizeof(struct user));
    read_bit(fptr, &stopped, sizeof(int));
    read_bit(fptr, &or, sizeof(struct cp_sparc_window_regs));
    /*
    if (action & ACTION_PRINT) {
	fprintf(stderr, "(registers): Process was %sstopped\n",
		stopped?"":"not ");
	fprintf(stderr, "\teax: 0x%08lx ebx: 0x%08lx ecx: 0x%08lx edx: 0x%08lx\n",
		user.regs.eax, user.regs.ebx, user.regs.ecx, user.regs.edx);
	fprintf(stderr, "\tesi: 0x%08lx edi: 0x%08lx ebp: 0x%08lx esp: 0x%08lx\n",
		user.regs.esi, user.regs.edi, user.regs.ebp, user.regs.esp);
	fprintf(stderr, "\t ds: 0x%08x  es: 0x%08x  fs: 0x%08x  gs: 0x%08x\n",
		user.regs.ds, user.regs.es, user.regs.fs, user.regs.gs);
	fprintf(stderr, "\teip: 0x%08lx eflags: 0x%08lx",
		user.regs.eip, user.regs.eflags);
    }
    */
    if (action & ACTION_LOAD)
	load_chunk_regs(&user, &or, stopped);
}
开发者ID:seanjensengrey,项目名称:cryopid.stable,代码行数:25,代码来源:cp_r_regs.c


示例4: pin_write_handler

static void pin_write_handler(ble_lbs_t * p_lbs, uint8_t * pin_state)
{  
    
    // Sets motor values for every motor.

    twi_set_motor(pin_state);

    // Sets the color for every RGB-LED.

    uint8_t web_color_data = read_byte(pin_state, 5);
    set_rgb_color(web_color_data);

    // Shoots IR-signal.
    if (read_bit(pin_state, 1, 0))
    {
        ir_shooting(pin_state);
        playNote(536);
        nrf_delay_ms(50);
        playNote(536);
    }
    
    // Turns laser on when game session is active
    if(read_bit(pin_state, 1, 1))
    {
       nrf_gpio_pin_set(LASER_TRANSISTOR);
    }
    else
       nrf_gpio_pin_clear(LASER_TRANSISTOR);

    write_car_id(pin_state[19]);
    unique_car_ID = pin_state[19];
}
开发者ID:jtguggedal,项目名称:Physical_Web_Toy_SDK_11,代码行数:32,代码来源:main.c


示例5: TRACE_INFO

/*!
 * \param *dc The current DecodingContext.
 * \param *slice structure.
 * \return *rplm_t initialized data structure.
 */
static rplm_t *decodeRPLM(DecodingContext_t *dc, slice_t *slice)
{
    TRACE_INFO(SLICE, "  > " BLD_GREEN "decodeRPLM()\n" CLR_RESET);

    // RPLM allocation
    ////////////////////////////////////////////////////////////////////////////

    rplm_t *rplm = (rplm_t*)calloc(1, sizeof(rplm_t));
    if (rplm == NULL)
    {
        TRACE_ERROR(SLICE, "Unable to alloc new RPLM!\n");
    }
    else
    {
        // RPLM decoding
        ////////////////////////////////////////////////////////////////////////

        if (slice->slice_type % 5 != 2 && slice->slice_type % 5 != 4)
        {
            rplm->ref_pic_list_modification_flag_l0 = read_bit(dc->bitstr);
            if (rplm->ref_pic_list_modification_flag_l0)
            {
                do {
                    rplm->modification_of_pic_nums_idc = read_ue(dc->bitstr);
                    if (rplm->modification_of_pic_nums_idc == 0 ||
                        rplm->modification_of_pic_nums_idc == 1)
                    {
                        rplm->abs_diff_pic_num_minus1 = read_ue(dc->bitstr);
                    }
                    else if (rplm->modification_of_pic_nums_idc == 2)
                    {
                        rplm->long_term_pic_num = read_ue(dc->bitstr);
                    }
                } while (rplm->modification_of_pic_nums_idc != 3);
            }
        }

        if (slice->slice_type % 5 == 1)
        {
            rplm->ref_pic_list_modification_flag_l1 = read_bit(dc->bitstr);
            if (rplm->ref_pic_list_modification_flag_l1)
            {
                do {
                    rplm->modification_of_pic_nums_idc = read_ue(dc->bitstr);
                    if (rplm->modification_of_pic_nums_idc == 0 ||
                        rplm->modification_of_pic_nums_idc == 1)
                    {
                        rplm->abs_diff_pic_num_minus1 = read_ue(dc->bitstr);
                    }
                    else if (rplm->modification_of_pic_nums_idc == 2)
                    {
                        rplm->long_term_pic_num = read_ue(dc->bitstr);
                    }
                } while (rplm->modification_of_pic_nums_idc != 3);
            }
        }
    }

    return rplm;
}
开发者ID:seanvk,项目名称:MiniVideo,代码行数:65,代码来源:h264_slice.c


示例6: parse_ue

AM_ERR CMp4Builder::get_pic_order(unsigned char* pBuffer, int size, int nal_unit_type, int* pic_order_cnt_lsb) {
  AM_U8* pSlice_header = pBuffer;
  AM_U8 bit_pos = 0;
  AM_INT first_mb_in_slice;
  AM_INT slice_type;
  AM_INT pic_parameter_set_id;
  AM_INT frame_num;
  pSlice_header += parse_ue(pSlice_header,&first_mb_in_slice,&bit_pos);
  pSlice_header += parse_ue(pSlice_header,&slice_type,&bit_pos);
  switch (slice_type) {
    case SLICE_P_0:
    case SLICE_P_1:
      if (_last_p_num == -1) {
        _last_p_num = mVideoCnt;
      } else {
        if (mH264Info.M == 0) {
          mH264Info.M = mVideoCnt - _last_p_num;
        }
      }
      break;
    case SLICE_I_0:
    case SLICE_I_1:
      if (_last_i_num == -1) {
        _last_i_num = mVideoCnt;
      } else {
        if (mH264Info.N == 0) {
          mH264Info.N = mVideoCnt - _last_i_num;
        }
      }
      break;
    default:
      break;
  }

  pSlice_header += parse_ue(pSlice_header,&pic_parameter_set_id,&bit_pos);
  pSlice_header += read_bit(pSlice_header,&frame_num,&bit_pos,
                            mSpsInfo.log2_max_frame_num_minus4+4);

  if (!mSpsInfo.frame_mbs_only_flag) {
    AM_BOOL field_pic_flag;
    AM_BOOL bottom_field_flag;
    pSlice_header += read_bit(pSlice_header, (AM_INT *)&field_pic_flag,&bit_pos);
    if (field_pic_flag)
      pSlice_header += read_bit(pSlice_header, (AM_INT *)&bottom_field_flag,&bit_pos);
  }
  if (nal_unit_type == NAL_IDR) {
    AM_INT idr_pic_id;
    pSlice_header += parse_ue(pSlice_header,&idr_pic_id,&bit_pos);
  }
  if( mSpsInfo.pic_order_cnt_type == 0 ) {
    pSlice_header += read_bit(pSlice_header,pic_order_cnt_lsb,&bit_pos,
                              mSpsInfo.log2_max_pic_order_cnt_lsb_minus4+4);
    int max_pic_order_cnt_lsb = 1<<(mSpsInfo.log2_max_pic_order_cnt_lsb_minus4+4);
    if (*pic_order_cnt_lsb > max_pic_order_cnt_lsb/2) {
      *pic_order_cnt_lsb -= max_pic_order_cnt_lsb;
    }
  }
  return ME_OK;
}
开发者ID:ShawnOfMisfit,项目名称:ambarella,代码行数:59,代码来源:mp4_builder.cpp


示例7: parse_program_stream_directory

/*!
 * \brief Parse a program stream directory structure.
 * \param *bitstr The bitstream to use.
 * \param *packet A program stream directory structure.
 * \return 1 if succeed, 0 otherwise.
 *
 * From 'ISO/IEC 13818-1' specification:
 * 2.5.5 Program Stream directory
 * Table 2-36 – Program Stream directory packet
 */
static int parse_program_stream_directory(Bitstream_t *bitstr, PesHeader_t *header, ProgramStreamDirectory_t *packet)
{
    TRACE_INFO(MPS, BLD_GREEN "parse_program_stream_directory()" CLR_RESET " @ %lli",
               header->offset_start);
    int retcode = SUCCESS;

    packet->number_of_access_units = read_bits(bitstr, 15);
    MARKER_BIT

    packet->prev_directory_offset = read_bits(bitstr, 15) << 30;
    MARKER_BIT
    packet->prev_directory_offset += read_bits(bitstr, 15) << 15;
    MARKER_BIT
    packet->prev_directory_offset += read_bits(bitstr, 15);
    MARKER_BIT

    packet->next_directory_offset = read_bits(bitstr, 15) << 30;
    MARKER_BIT
    packet->next_directory_offset += read_bits(bitstr, 15) << 15;
    MARKER_BIT
    packet->next_directory_offset += read_bits(bitstr, 15);
    MARKER_BIT

    for (uint16_t i = 0; i < packet->number_of_access_units; i++)
    {
        // TODO stack it?
        packet->packet_stream_id = read_bits(bitstr, 8);
        packet->PES_header_position_offset_sign = read_bit(bitstr);

        packet->PES_header_position_offset = read_bits(bitstr, 14) << 30;
        MARKER_BIT
        packet->PES_header_position_offset += read_bits(bitstr, 15) << 15;
        MARKER_BIT
        packet->PES_header_position_offset += read_bits(bitstr, 15);
        MARKER_BIT

        packet->reference_offset = read_bits(bitstr, 16);
        MARKER_BIT
        /*unsigned reserved1 =*/ read_bits(bitstr, 3);

        packet->PTS = read_bits(bitstr, 3) << 30;
        MARKER_BIT
        packet->PTS += read_bits(bitstr, 15) << 15;
        MARKER_BIT
        packet->PTS += read_bits(bitstr, 15);
        MARKER_BIT

        packet->byes_to_read = read_bits(bitstr, 15) << 15;
        MARKER_BIT
        packet->byes_to_read += read_bits(bitstr, 8);
        MARKER_BIT

        packet->intra_coded_indicator = read_bit(bitstr);
        packet->coding_parameters_indicator = read_bits(bitstr, 2);
        /*unsigned reserved2 =*/ read_bits(bitstr, 4);
    }

    return retcode;
}
开发者ID:emericg,项目名称:MiniVideo,代码行数:69,代码来源:ps.cpp


示例8: read_result

static int read_result(hx711_task* task)
{
	int result;

	result = -read_bit(task);
	for(int i=0;i<23;i++)
	{
		result <<= 1;
		result |= read_bit(task);
	}
	return result;
}
开发者ID:lantti,项目名称:RestessbarKSreporter,代码行数:12,代码来源:measure.c


示例9: rebuild_tree

static void rebuild_tree(LHAPM2Decoder *decoder)
{
	switch (decoder->tree_state) {

		// Initial tree build, from start of stream:

		case PM2_REBUILD_UNBUILT:
			read_code_tree(decoder);
			read_offset_tree(decoder, 5);
			decoder->tree_state = PM2_REBUILD_BUILD1;
			decoder->tree_rebuild_remaining = 1024;
			break;

		// Tree rebuild after 1KiB of data has been read:

		case PM2_REBUILD_BUILD1:
			read_offset_tree(decoder, 6);
			decoder->tree_state = PM2_REBUILD_BUILD2;
			decoder->tree_rebuild_remaining = 1024;
			break;

		// Tree rebuild after 2KiB of data has been read:

		case PM2_REBUILD_BUILD2:
			read_offset_tree(decoder, 7);
			decoder->tree_state = PM2_REBUILD_BUILD3;
			decoder->tree_rebuild_remaining = 2048;
			break;

		// Tree rebuild after 4KiB of data has been read:

		case PM2_REBUILD_BUILD3:
			if (read_bit(&decoder->bit_stream_reader) == 1) {
				read_code_tree(decoder);
			}
			read_offset_tree(decoder, 8);
			decoder->tree_state = PM2_REBUILD_CONTINUING;
			decoder->tree_rebuild_remaining = 4096;
			break;

		// Tree rebuild after 8KiB of data has been read,
		// and every 4KiB after that:

		case PM2_REBUILD_CONTINUING:
			if (read_bit(&decoder->bit_stream_reader) == 1) {
				read_code_tree(decoder);
				read_offset_tree(decoder, 8);
			}
			decoder->tree_rebuild_remaining = 4096;
			break;
	}
}
开发者ID:djdron,项目名称:zxtune,代码行数:52,代码来源:pm2_decoder.c


示例10: while

void compressed_file_reader::get_next()
{
    uint64_t numberBits = 0;
    while (status_ == 0 && !read_bit())
        ++numberBits;

    current_value_ = 0;
    for (int64_t bit = numberBits - 1; status_ == 0 && bit >= 0; --bit)
    {
        if (read_bit())
            current_value_ |= (1 << bit);
    }

    current_value_ |= (1 << numberBits);
}
开发者ID:AlexOcculate,项目名称:meta,代码行数:15,代码来源:compressed_file_reader.cpp


示例11: clock_setup_pulses

static void clock_setup_pulses(hx711_task* task)
{
	int setup_pulses;

	switch (task->op)
	{
		case A128:
			setup_pulses = 1;
			break;
		case A64:
			setup_pulses = 3;
			break;
		case B32:
			setup_pulses = 2;
			break;
		default:
			setup_pulses = 1;
	}

	for (int i=0;i<setup_pulses;i++)
	{
		read_bit(task);
	}

}
开发者ID:lantti,项目名称:RestessbarKSreporter,代码行数:25,代码来源:measure.c


示例12: lha_pm2_decoder_read

static size_t lha_pm2_decoder_read(void *data, uint8_t *buf)
{
	LHAPM2Decoder *decoder = data;
	size_t result;
	int code;

	// On first pass through, build initial lookup trees.

	if (decoder->tree_state == PM2_REBUILD_UNBUILT) {

		// First bit in stream is discarded?

		read_bit(&decoder->bit_stream_reader);
		rebuild_tree(decoder);
	}

	result = 0;

	code = read_from_tree(&decoder->bit_stream_reader, decoder->code_tree);

	if (code < 0) {
		return 0;
	}

	if (code < 8) {
		read_single_byte(decoder, (unsigned int) code, buf, &result);
	} else {
		copy_from_history(decoder, (unsigned int) code - 8,
		                  buf, &result);
	}

	return result;
}
开发者ID:djdron,项目名称:zxtune,代码行数:33,代码来源:pm2_decoder.c


示例13: while

int BinaryFileReader::read_omega() {
	int number = 1;
	while (read_bit() == 1) {
		number = read_binary(number);
	}
	return number;
}
开发者ID:tructvt,项目名称:Android-Project,代码行数:7,代码来源:binary_file_reader.cpp


示例14: funzip

int funzip()
{
	PHuftree_node p;
	unsigned char b,byte;

	p=&huftree[512];

	while (p->num != 256)
	{
		b=read_bit(F_SRC);

		if (b)
			p=&huftree[p->rchild];
		else
			p=&huftree[p->lchild];

		if (p->num < 256)
		{
			byte=(unsigned char)(p->num);
			write_byte(F_DST,&byte);
			p=&huftree[512];
		}
	}
	return 0;
}
开发者ID:vigoals,项目名称:dataStruct,代码行数:25,代码来源:haf.c


示例15: output_rxd

void compucolor_floppy_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	if (!m_sel && !m_rw)
	{
		output_rxd(read_bit());
	}
}
开发者ID:DanielAeolusLaude,项目名称:mame,代码行数:7,代码来源:floppy.c


示例16: writeSP

// write to scratchpad of a SINGLE sensor
void writeSP(int brdNo) {
    int i;
    int get[8];

    ow_reset();
    write_byte(0xCC);
    write_byte(0x4E);
    write_byte(brdNo);
    write_byte(0x0);
    write_byte(0x7F);
    while(read_bit() == 0);

    ow_reset();
    write_byte(0xCC);
    write_byte(0x48);
    uDelay(120);

    ow_reset();
    write_byte(0xCC);
    uDelay(120);
    write_byte(0xBE);
    for (i = 0 ; i < 9 ; i++){
        get[i] = read_byte();
    }

    if(get[2] != brdNo || get[3] != 0 || get[4] != 0x7F) {
        UART_printf("BAD CONFIGURATION?\n");
    }
}
开发者ID:sunswift,项目名称:sunswift.bms,代码行数:30,代码来源:onewire.c


示例17: parse_program_stream_map

/*!
 * \brief Parse a program stream map structure.
 * \param *bitstr The bitstream to use.
 * \param *header PES packet header.
 * \param *packet A program stream map structure.
 * \return 1 if succeed, 0 otherwise.
 *
 * \todo Parse desciptors.
 *
 * From 'ISO/IEC 13818-1' specification:
 * 2.5.4 Program Stream map
 * Table 2-35 – Program Stream map
 */
int parse_program_stream_map(Bitstream_t *bitstr, PesHeader_t *header, ProgramStreamMap_t *packet)
{
    TRACE_INFO(MPS, BLD_GREEN "parse_program_stream_map()" CLR_RESET " @ %lli",
               header->offset_start);
    int retcode = SUCCESS;
    int i = 0, N1 = 0, N2 = 0;

    packet->current_next_indicator = read_bit(bitstr);
    /*int reserved1 =*/ read_bits(bitstr, 2);
    packet->program_stream_map_version = read_bits(bitstr, 5);
    /*int reserved2 =*/ read_bits(bitstr, 7);
    MARKER_BIT
    packet->program_stream_map_info_length = read_bits(bitstr, 16);
    for (i = 0; i < N1; i++)
    {
        // descriptor()
    }

    packet->elementary_stream_map_length = read_bits(bitstr, 16);
    for (i = 0; i < N1; i++)
    {
        // Stack it?
        packet->stream_type = read_bits(bitstr, 8);
        packet->elementary_stream_id = read_bits(bitstr, 8);
        packet->elementary_stream_info_length = read_bits(bitstr, 16);
        for (i = 0; i < N2; i++)
        {
            // descriptor()
        }
    }

    packet->CRC_32 = read_bits(bitstr, 32);

    return retcode;
}
开发者ID:emericg,项目名称:MiniVideo,代码行数:48,代码来源:ps.cpp


示例18: malloc

char *deflate_decompress(char *data, int data_length, int max_size)
{
    char *buf = malloc(max_size * sizeof(char));
    int pos = 0;

    bitstream_t *bitstream = calloc(1, sizeof(bitstream_t));
    bitstream->data = data;

    int final, type;

    do {
        final = read_bit(bitstream);
        type = read_bits(bitstream, 2);

        if (type == 0) {
            pos = deflate_process_uncompressed(buf, pos, bitstream);
        } else if (type == 1 || type == 2) {
            htree_t *htree_lit, *htree_dist;

            if (type == 1) {
                deflate_get_fixed_htrees(&htree_lit, &htree_dist);
            } else {
                deflate_parse_htrees(bitstream, &htree_lit, &htree_dist);
            }

            pos = deflate_process_huffman(buf, pos, bitstream,
                htree_lit, htree_dist);

            /* Free the Huffman trees. */
            huffman_free_tree(htree_lit);
            huffman_free_tree(htree_dist);
        } else {
            printf("Error: Invalid deflate block type\n");
        }
    } while (!final);
开发者ID:evegard,项目名称:pngview,代码行数:35,代码来源:deflate.c


示例19: read_code

static int read_code(LHALH1Decoder *decoder, uint16_t *result)
{
    unsigned int node_index;
    int bit;

    // Start from the root node, and traverse down until a leaf is
    // reached.

    node_index = 0;

    //printf("<root ");
    while (!decoder->nodes[node_index].leaf) {
        bit = read_bit(&decoder->bit_stream_reader);

        if (bit < 0) {
            return 0;
        }

        //printf("<%i>", bit);

        // Choose one of the two children depending on the
        // bit that was read.

        node_index = decoder->nodes[node_index].child_index
                     - (unsigned int) bit;
    }

    *result = decoder->nodes[node_index].child_index;
    //printf(" -> %i!>\n", *result);

    increment_for_code(decoder, *result);

    return 1;
}
开发者ID:kacmem,项目名称:zxtune,代码行数:34,代码来源:lh1_decoder.c


示例20: read_chunk_tls

void read_chunk_tls(void *fptr, int action)
{
    struct user_desc u;
    int ret;

    read_bit(fptr, &u, sizeof(struct user_desc));

    if (!u.base_addr)
	return;

    if (action & ACTION_PRINT)
	fprintf(stderr, "TLS entry (%d): base_addr = 0x%lx", 
		u.entry_number, u.base_addr);

    if (!(action & ACTION_LOAD))
	return;

    if (!emulate_tls) {
	ret = set_thread_area(NULL);
	if (ret == -1) /* some libcs return the actual errno instead of -1 */
	    ret = -errno;
	if (ret == -ENOSYS) {
	    /* We are not a TLS capable system. Turn on TLS emulation voodoo. */
	    emulate_tls = 1;

	    /* We'll need write access to the code segments to do this. */
	    extra_prot_flags |= PROT_WRITE;
	}
    }

    if (emulate_tls)
	tls_base_address = u.base_addr;
    else
	syscall_check(set_thread_area(&u), 0, "set_thread_area");
}
开发者ID:0gobi,项目名称:cryopid,代码行数:35,代码来源:cp_r_tls.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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