Giter Site home page Giter Site logo

rzulu54 / vba7_ulonglong Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.28 MB

Emulate ULongLong 64 bit unsigned integers with VBA7 (64/32 bit MsOffice) or VB6

License: MIT License

Visual Basic 6.0 2.07% VBA 97.93%
64-bit vb6 vba7 ulonglong excel excel-vba bitwise-operations integers unsigned unsigned-integers

vba7_ulonglong's Introduction

VBA7_ULongLong

Emulate ULongLong 64 bit unsigned integers with VBA7 (64/32 bit MsOffice) or VB6 (Visual Basic 6)


The problem with VBA/VB6 is that there are no 64-bit unsigned integers (ULongLong) available.

The module 'bas64BitOperations.bas' contains functions to emulate bit operations for 64-bit unsigned integers.

For 32-bit MsOffice VBA or VB6 we can use two Long 32-bit signed integers combined in a new datatype TBit64.

  • this requires functions for basic bit operations like AND, OR, XOR, NOT.

For 64-bit MsOffice VBA7 we can use the new 64-bit signed integer datatype LongLong.

  • basic bit operations like AND, OR, XOR, NOT do NOT need extra functions but can be used directly.

Functions available for both variants are:

  • SetBit64, ClearBit64, ShiftLeft64, ShiftRight64, PopCnt64 (number of bits set),

    Lsb64 (position of left most bit), Rsb64 (position of left most bit) and some more.

The Ms-Excel file VBA7.xlsm shows how to use these functions for 32/64-bit MsOffice.

For 64-bit Excel there is also a simple chess demonstration how to use 64-bit chessboard logic.

(for the best Excel/VB6 chess program available please see my project at github.com/RZulu54/ChessBrainVB)

Hint: For arithemetic operations the VB Variant subtype vbDecimal can be used.

' Largest Decimal: +/- 79228162514264337593543950335. 2^96-1 (sign bit handled separately)

' Smallest Decimal: +/- 0.0000000000000000000000000001

Dim D1 as Variant
D1 = CDec(2 ^ 95): D1 = D1 / 2#

vba7_ulonglong's People

Contributors

rzulu54 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.