403Webshell
Server IP : 104.21.38.3  /  Your IP : 162.158.106.35
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/storage/innobase/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/storage/innobase/include/fts0vlc.ic
/*****************************************************************************

Copyright (c) 2007, 2023, Oracle and/or its affiliates.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.

This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation.  The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License, version 2.0, for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA

*****************************************************************************/

/******************************************************************//**
@file include/fts0vlc.ic
Full text variable length integer encoding/decoding.

Created 2007-03-27 Sunny Bains
*******************************************************/

#ifndef INNOBASE_FTS0VLC_IC
#define INNOBASE_FTS0VLC_IC

#include "fts0types.h"

/******************************************************************//**
Return length of val if it were encoded using our VLC scheme.
FIXME: We will need to be able encode 8 bytes value
@return length of value encoded, in bytes */
UNIV_INLINE
ulint
fts_get_encoded_len(
/*================*/
	ulint	val)	/* in: value to encode */
{
	if (val <= 127) {
		return(1);
	} else if (val <= 16383) {
		return(2);
	} else if (val <= 2097151) {
		return(3);
	} else if (val <= 268435455) {
		return(4);
	} else {
		/* Possibly we should care that on 64-bit machines ulint can
		contain values that we can't encode in 5 bytes, but
		fts_encode_int doesn't handle them either so it doesn't much
		matter. */

		return(5);
	}
}

/******************************************************************//**
Encode an integer using our VLC scheme and return the length in bytes.
@return length of value encoded, in bytes */
UNIV_INLINE
ulint
fts_encode_int(
/*===========*/
	ulint	val,	/* in: value to encode */
	byte*	buf)	/* in: buffer, must have enough space */
{
	ulint	len;

	if (val <= 127) {
		*buf = (byte) val;

		len = 1;
	} else if (val <= 16383) {
		*buf++ = (byte)(val >> 7);
		*buf = (byte)(val & 0x7F);

		len = 2;
	} else if (val <= 2097151) {
		*buf++ = (byte)(val >> 14);
		*buf++ = (byte)((val >> 7) & 0x7F);
		*buf = (byte)(val & 0x7F);

		len = 3;
	} else if (val <= 268435455) {
		*buf++ = (byte)(val >> 21);
		*buf++ = (byte)((val >> 14) & 0x7F);
		*buf++ = (byte)((val >> 7) & 0x7F);
		*buf = (byte)(val & 0x7F);

		len = 4;
	} else {
		/* Best to keep the limitations of the 32/64 bit versions
		identical, at least for the time being. */
		ut_ad(val <= 4294967295u);

		*buf++ = (byte)(val >> 28);
		*buf++ = (byte)((val >> 21) & 0x7F);
		*buf++ = (byte)((val >> 14) & 0x7F);
		*buf++ = (byte)((val >> 7) & 0x7F);
		*buf = (byte)(val & 0x7F);

		len = 5;
	}

	/* High-bit on means "last byte in the encoded integer". */
	*buf |= 0x80;

	return(len);
}

/******************************************************************//**
Decode and return the integer that was encoded using our VLC scheme.
@return value decoded */
UNIV_INLINE
ulint
fts_decode_vlc(
/*===========*/
	byte**	ptr)	/* in: ptr to decode from, this ptr is
			incremented by the number of bytes decoded */
{
	ulint	val = 0;

	for (;;) {
		byte	b = **ptr;

		++*ptr;
		val |= (b & 0x7F);

		/* High-bit on means "last byte in the encoded integer". */
		if (b & 0x80) {
			break;
		} else {
			val <<= 7;
		}
	}

	return(val);
}

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit