Skip to content

Instantly share code, notes, and snippets.

@zamabuvaraeu
Created January 21, 2021 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamabuvaraeu/029297874466057af0f9138abcc088b2 to your computer and use it in GitHub Desktop.
Save zamabuvaraeu/029297874466057af0f9138abcc088b2 to your computer and use it in GitHub Desktop.
Деление 64‐битных знаковых целых чисел
#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