Server IP : 195.201.23.43 / Your IP : 18.218.96.239 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/rsa/ |
Upload File : |
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Detection of 32-bit and 64-bit machines and byte alignment.""" import sys MAX_INT = sys.maxsize MAX_INT64 = (1 << 63) - 1 MAX_INT32 = (1 << 31) - 1 MAX_INT16 = (1 << 15) - 1 # Determine the word size of the processor. if MAX_INT == MAX_INT64: # 64-bit processor. MACHINE_WORD_SIZE = 64 elif MAX_INT == MAX_INT32: # 32-bit processor. MACHINE_WORD_SIZE = 32 else: # Else we just assume 64-bit processor keeping up with modern times. MACHINE_WORD_SIZE = 64 def get_word_alignment(num, force_arch=64, _machine_word_size=MACHINE_WORD_SIZE): """ Returns alignment details for the given number based on the platform Python is running on. :param num: Unsigned integral number. :param force_arch: If you don't want to use 64-bit unsigned chunks, set this to anything other than 64. 32-bit chunks will be preferred then. Default 64 will be used when on a 64-bit machine. :param _machine_word_size: (Internal) The machine word size used for alignment. :returns: 4-tuple:: (word_bits, word_bytes, max_uint, packing_format_type) """ max_uint64 = 0xffffffffffffffff max_uint32 = 0xffffffff max_uint16 = 0xffff max_uint8 = 0xff if force_arch == 64 and _machine_word_size >= 64 and num > max_uint32: # 64-bit unsigned integer. return 64, 8, max_uint64, "Q" elif num > max_uint16: # 32-bit unsigned integer return 32, 4, max_uint32, "L" elif num > max_uint8: # 16-bit unsigned integer. return 16, 2, max_uint16, "H" else: # 8-bit unsigned integer. return 8, 1, max_uint8, "B"Private