Created
January 21, 2021 10:40
-
-
Save zamabuvaraeu/029297874466057af0f9138abcc088b2 to your computer and use it in GitHub Desktop.
Деление 64‐битных знаковых целых чисел
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "windows.bi" | |
#include "win\ole2.bi" | |
#include "win\oleauto.bi" | |
Function Integer64Division( _ | |
ByVal LeftValue As LongInt, _ | |
ByVal RightValue As LongInt _ | |
)As LongInt | |
Dim varLeft As VARIANT = Any | |
varLeft.vt = VT_I8 | |
varLeft.llVal = LeftValue | |
Dim varRight As VARIANT = Any | |
varRight.vt = VT_I8 | |
varRight.llVal = RightValue | |
Dim varResult As VARIANT = Any | |
VariantInit(@varResult) | |
Dim hr As HRESULT = VarIdiv( _ | |
@varLeft, _ | |
@varRight, _ | |
@varResult _ | |
) | |
If FAILED(hr) Then | |
Return 0 | |
End If | |
Return varResult.llVal | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment