Skip to main content

No project description provided

Project description

Aalign

Fully name: Adamlibrary.Align

It is an adamlibrary-based library where you can make real alignment calculations in Python. You cannot directly guarantee the real alignment value in Python, other than the value it produces at runtime, but aalign offers a sample aligment library abstraction using the adamlibrary memreplication_cutline modules that will guarantee this! This abstraction is an example of the use of adamlibrary. Anyone who wants to access raw pointer can develop methods to control memory interaction, real memreplication cutline, directly access raw pointer, list the memory string like aalign, there are no restrictions, all control and responsibility is on you.

Usage

Context manager

from aalign import AlignedBuffer

with AlignedBuffer(size=4096, alignment=64) as buf:
    print(buf.size, buf.alignment, buf.usable_size)
# with block output auto free()

Lifetime handling

from aalign import AlignedBuffer

buf = AlignedBuffer(size=256, alignment=32)
try:
    print(buf.usable_size)
finally:
    buf.free()  # idempotent, second double calling not is problem

posix_memalign controlling

buf = AlignedBuffer(size=128, alignment=16, strategy="posix_memalign")

Free late using (error is)

from aalign import AlignedBuffer, AlreadyFreedError

buf = AlignedBuffer(size=64, alignment=16)
buf.free()

try:
    buf.usable_size
except AlreadyFreedError as e:
    print(e)  # this AlignedBuffer has already been freed

Context proccesing - reset

from aalign import zero_buffer

data = bytearray(b"\xAA" * 32)
zero_buffer(data)
print(data.hex())  # full 00

Context processing - byte finder

from aalign import find_byte

data = bytearray(b"hello_world")
result = find_byte(data, ord("w"))
print(result)  # b'world'

CLI using

python3 -m aalign
python3 -m aalign --size 128 4096 --alignment 16 64

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aalign-1.0.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file aalign-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aalign-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for aalign-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e54d32f1cf258119825c2c6492fdcd412878d2ae9d95d06c6c5701b353084a0c
MD5 97c36a9e2d3b115e97f0a42997b36a29
BLAKE2b-256 eb3c25d62dd4b9b6149fe23a50b58f248d429015a951c767d3e5a31e1edc2d69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page