Rizin
unix-like reverse engineering framework and cli tools
memcmplen.h File Reference

Optimized comparison of two buffers. More...

#include "common.h"

Go to the source code of this file.

Macros

#define LZMA_MEMCMPLEN_EXTRA   0
 

Functions

static uint32_t lzma_attribute ((__always_inline__)) lzma_memcmplen(const uint8_t *buf1
 
 assert (limit<=UINT32_MAX/2)
 
 while (len< limit &&buf1[len]==buf2[len])++len
 

Variables

static uint32_t const uint8_tbuf2
 
static uint32_t const uint8_t uint32_t len
 
static uint32_t const uint8_t uint32_t uint32_t limit
 

Detailed Description

Optimized comparison of two buffers.

Definition in file memcmplen.h.

Macro Definition Documentation

◆ LZMA_MEMCMPLEN_EXTRA

#define LZMA_MEMCMPLEN_EXTRA   0

Definition at line 156 of file memcmplen.h.

Function Documentation

◆ assert()

assert ( limit<=UINT32_MAX 2)

Referenced by _nettle_aes_set_key(), aarch64_ext_advsimd_imm_modified(), aarch64_ext_advsimd_imm_shift(), aarch64_ext_imm_rotate1(), aarch64_ext_imm_rotate2(), aarch64_ext_ldst_elemlist(), aarch64_ext_ldst_reglist_r(), aarch64_ext_reg_extended(), aarch64_ext_reglane(), aarch64_ext_regno_pair(), aarch64_ext_regrt_sysins(), aarch64_ext_sysins_op(), aarch64_extract_operand(), aarch64_get_expected_qualifier(), aarch64_get_qualifier_esize(), aarch64_get_qualifier_nelem(), aarch64_get_qualifier_standard_value(), aarch64_num_of_operands(), aarch64_opcode_decode(), aarch64_print_operand(), address_prefix_match(), alone_encode(), array__erase(), array__splice(), auto_decode(), auto_decoder_memconfig(), basicTests(), been_here(), block_buffer_encode(), block_encode(), block_encode_uncompressed(), BMK_benchMem(), buf_sparse_resize(), build_immediate_table(), capture_list_pool_get_mut(), close_pipe(), coder_init(), coder_normal(), compress_file(), compress_file_internal(), compressed_name(), convert_bfm_to_bfc(), convert_movebitmask_to_mov(), copy_or_code(), count(), create_curl_context(), decode_asimd_fcvt(), decode_buffer(), decode_limm(), decompress_file(), decompress_file_allocDst(), decompress_file_internal(), def(), delta_decode(), determine_disassembling_preference(), dict_repeat(), do_special_decoding(), encode_init(), encode_instruction(), encode_symbol(), env_strncmp(), eof_timer_cb(), eof_timer_close_cb(), eof_timer_destroy(), eof_timer_init(), eof_timer_start(), eof_timer_stop(), epoll_wait(), examine(), exit_wait_callback(), expand_fp_imm(), extract_fields(), fill_window(), fs__capture_path(), fs__close(), fs__filemap_ex_filter(), fs__read_filemap(), fs__wide_to_utf8(), fs__write_filemap(), fullSpeedBench(), FUZ_test(), FUZ_unitTests(), fuzzerTests(), gdbr_lock_leave(), get_addr_sve_reg_name(), get_cond_from_value(), get_expected_qualifier(), get_greg_qualifier_from_value(), get_lower_bound(), get_options(), get_upper_bound(), getexe(), hardware_memlimit_set(), helper1(), index_decode(), index_dup_stream(), index_encode(), index_tree_append(), index_tree_end(), index_tree_locate(), inf(), insert_field_2(), interact_break_asm(), interact_break_cmd(), interact_commands(), interact_fix_asm(), interact_fix_cmd(), io_close_dest(), io_close_src(), io_fix_src_pos(), io_open_src_real(), io_read(), io_write(), io_write_buf(), is_sparse(), iter_set_info(), length(), literal_init(), LLVMFuzzerReturnOneInput(), LLVMFuzzerTestOneInput(), local_LZ4_createStream(), local_LZ4_resetDictT(), local_LZ4F_compressFrame(), local_LZ4F_decompress(), local_LZ4F_decompress_followHint(), local_LZ4F_decompress_noHint(), LZ4_compressHC_continue_generic(), LZ4_loadDictHC(), LZ4_saveDictHC(), LZ4HC_compress_generic_dictCtx(), LZ4HC_compress_generic_internal(), LZ4HC_compress_generic_noDictCtx(), LZ4HC_compress_hashChain(), LZ4HC_compress_optimal(), LZ4HC_countBack(), LZ4HC_encodeSequence(), LZ4HC_InsertAndGetWiderMatch(), LZ4HC_literalsPrice(), LZ4HC_sequencePrice(), LZ4IO_blockTypeID(), LZ4IO_compressFilename_Legacy(), LZ4IO_decompressSrcFile(), LZ4IO_displayCompressedFilesInfo(), LZ4IO_openDstFile(), LZ4IO_skipBlocksData(), lzma2_decode(), lzma2_decoder_end(), lzma2_encode(), lzma2_header_lzma(), lzma2_header_uncompressed(), LZMA_API(), lzma_decode(), lzma_lzma2_decoder_init(), lzma_lzma_decoder_init(), lzma_lzma_encode(), lzma_lzma_lclppb_encode(), lzma_lzma_optimum_fast(), lzma_lzma_optimum_normal(), lzma_mf_find(), lzma_next_filter_update(), lzma_outq_get_buf(), main(), make_program_env(), message_filters_to_str(), message_progress_end(), message_progress_update(), mf_read(), move_pending(), move_pos(), move_window(), mythread_sigmask(), nettle_aes128_decrypt(), nettle_aes128_encrypt(), nettle_aes192_decrypt(), nettle_aes192_encrypt(), nettle_aes256_decrypt(), nettle_aes256_encrypt(), nios2_control_regs(), nios2_coprocessor_regs(), normalize(), on_new_connection(), on_open(), operand_general_constraint_met_p(), parse_block_list(), parser__accept(), parser__handle_error(), partcompress(), pipe_alloc_accept(), pipe_connect_thread_proc(), pipe_shutdown_thread_proc(), post_completion(), post_completion_read_wait(), post_completion_write_wait(), post_write_completion(), print_immediate_offset_address(), print_insn_aarch64_word(), print_register_list(), progress_pos(), rc_encode(), RDG_fillLiteralDistrib(), read_bin(), read_times(), recompress(), remove_dot_suffix(), roundTripTest(), rz_analysis_block_ref(), rz_analysis_block_unref(), safe_fwrite(), score(), select_operand_for_fptype_field_coding(), select_operand_for_scalar_size_field_coding(), select_operand_for_sf_field_coding(), set_exit_status(), signals_unblock(), simple_code(), split_block(), stack_node_release(), stack_node_retain(), stream_decode(), stream_encode(), stream_encode_mt(), stream_encoder_mt_init(), string_init(), string_printf(), suffix_get_dest_name(), test_lz4f_decompression(), test_lz4f_decompression_wBuffers(), threads_end(), timer_cb(), timer_close_cb(), ts_language_table_entry(), ts_parser__accept(), ts_parser__handle_error(), ts_parser__recover_to_state(), ts_query__analyze_patterns(), ts_query__step_is_fallible(), ts_stack_copy_version(), ts_stack_pop_error(), ts_stack_renumber_version(), ts_stack_resume(), ts_subtree_release(), ts_subtree_retain(), ts_subtree_set_symbol(), ts_subtree_summarize_children(), uint64_to_nicestr(), uint64_to_str(), uncompress(), UTIL_createFileList(), uv__accept(), uv__async_io(), uv__build_coalesced_write_req(), uv__cancel_read_console(), uv__chld(), uv__close(), uv__close_nocheckstdio(), uv__create_stdio_pipe_pair(), uv__drain(), uv__fast_poll_process_poll_req(), uv__finish_close(), uv__fs_done(), uv__fs_preadv(), uv__fs_work(), uv__get_cpu_speed(), uv__getaddrinfo_done(), uv__getaddrinfo_translate_error(), uv__getnameinfo_done(), uv__hrtime(), uv__inotify_fork(), uv__inotify_read(), uv__io_active(), uv__io_init(), uv__io_poll(), uv__io_start(), uv__io_stop(), uv__loop_close(), uv__make_close_pending(), uv__once_inner(), uv__pipe_interrupt_read(), uv__pipe_read_exactly(), uv__pipe_write(), uv__pipe_write_data(), uv__pipe_write_ipc(), uv__platform_invalidate_fd(), uv__poll_set(), uv__pollfds_add(), uv__pollfds_del(), uv__process_init_stdio(), uv__read(), uv__server_io(), uv__signal_event(), uv__signal_handler(), uv__signal_start(), uv__signal_stop(), uv__slow_poll_process_poll_req(), uv__slow_poll_submit_poll_req(), uv__slow_poll_thread_proc(), uv__slurp(), uv__stdio_create(), uv__stream_close(), uv__stream_connect(), uv__stream_destroy(), uv__stream_io(), uv__stream_open(), uv__stream_osx_interrupt_select(), uv__stream_recv_cmsg(), uv__tcp_connect(), uv__tcp_xfer_import(), uv__tty_console_signal_resize(), uv__tty_make_raw(), uv__udp_finish_close(), uv__udp_io(), uv__udp_maybe_deferred_bind(), uv__udp_recvmsg(), uv__udp_run_completed(), uv__udp_send(), uv__udp_sendmsg(), uv__udp_try_send(), uv__wake_all_loops(), uv__write(), uv__write_int(), uv__write_req_size(), uv__write_req_update(), uv_accept(), uv_async_endgame(), uv_async_send(), uv_barrier_destroy(), uv_close(), uv_cpu_info(), uv_exepath(), uv_fs_event_endgame(), uv_fs_event_queue_readdirchanges(), uv_fs_event_start(), uv_fs_event_stop(), uv_fs_poll_getpath(), uv_fs_poll_stop(), uv_fs_scandir_next(), uv_get_process_title(), uv_insert_pending_req(), uv_interface_addresses(), uv_listen(), uv_loop_delete(), uv_loop_watcher_endgame(), uv_os_uname(), uv_pipe_connect(), uv_pipe_connection_init(), uv_pipe_endgame(), uv_pipe_listen(), uv_pipe_open(), uv_pipe_queue_accept(), uv_pipe_queue_read(), uv_pipe_writefile_thread_proc(), uv_pipe_zero_readfile_thread_proc(), uv_poll_endgame(), uv_poll_init_socket(), uv_poll_start(), uv_poll_stop(), uv_process_async_wakeup_req(), uv_process_endgame(), uv_process_endgames(), uv_process_fs_event_req(), uv_process_pipe_accept_req(), uv_process_pipe_connect_req(), uv_process_pipe_read_req(), uv_process_pipe_shutdown_req(), uv_process_pipe_write_req(), uv_process_proc_exit(), uv_process_reqs(), uv_process_signal_req(), uv_process_tcp_accept_req(), uv_process_tcp_connect_req(), uv_process_tcp_read_req(), uv_process_tcp_write_req(), uv_process_tty_read_line_req(), uv_process_tty_read_raw_req(), uv_process_tty_read_req(), uv_process_udp_recv_req(), uv_process_udp_send_req(), uv_read_start(), uv_relative_path(), uv_resident_set_memory(), uv_shutdown(), uv_signal_endgame(), uv_signal_stop(), uv_sleep(), uv_spawn(), uv_tcp_accept(), uv_tcp_endgame(), uv_tcp_listen(), uv_tcp_queue_accept(), uv_tcp_queue_read(), uv_tcp_set_socket(), uv_tcp_try_cancel_io(), uv_try_write(), uv_tty_close(), uv_tty_endgame(), uv_tty_line_read_thread(), uv_tty_post_raw_read(), uv_tty_queue_read_line(), uv_tty_queue_read_raw(), uv_udp_endgame(), uv_udp_queue_recv(), uv_udp_set_multicast_interface(), uv_udp_set_socket(), uv_update_time(), uv_utf8_to_utf16_alloc(), uv_write(), uv_write2(), value_fit_signed_field_p(), value_fit_unsigned_field_p(), vli_ceil4(), worker_encode(), worker_error(), worker_start(), write_bin(), xrealloc(), xstrdup(), xtime(), XXH32_finalize(), and XXH64_finalize().

◆ lzma_attribute()

static uint32_t lzma_attribute ( (__always_inline__)  ) const
inlinestatic

Find out how many equal bytes the two buffers have.

Parameters
buf1First buffer
buf2Second buffer
lenHow many bytes have already been compared and will be assumed to match
limitHow many bytes to compare at most, including the already-compared bytes. This must be significantly smaller than UINT32_MAX to avoid integer overflows. Up to LZMA_MEMCMPLEN_EXTRA bytes may be read past the specified limit from both buf1 and buf2.
Returns
Number of equal bytes in the buffers is returned. This is always at least len and at most limit.
Note
LZMA_MEMCMPLEN_EXTRA defines how many extra bytes may be read. It's rounded up to 2^n. This extra amount needs to be allocated in the buffers being used. It needs to be initialized too to keep Valgrind quiet.

◆ while()

Variable Documentation

◆ buf2

Definition at line 43 of file memcmplen.h.

Referenced by file_fsmagic(), is_pointer(), migrateCommand(), and rz_core_cmp_mem_mem().

◆ len

return len

Definition at line 44 of file memcmplen.h.

◆ limit