Recently I was asked in a private email about the fastest way of calculating of binomial coefficients mod 2 in Maple. It shouldn't be a problem for anybody reading my assembly dll creation manual. Anyway, here is the assembly code,
.586                                     ; for 586 processor or better
.model flat, stdcall                     ; 32-bit memory and standard call 

.code                                    ; the beginning of the code section
LibMain proc h:DWORD, r:DWORD, u:DWORD   ; the dll entry point
        mov eax, 1                       ; if eax is 0, the dll won't start
        ret                              ; return
LibMain Endp                             ; end of the dll entry

B2      proc a:DWORD, b:DWORD
        mov eax, a
        mov edx, b
        and eax, edx
        cmp eax, edx
        jz E1
        mov eax, 0
        jmp E
    E1: 
        mov eax, 1
     E: 
        ret 
B2      endp 

End LibMain
The source and the binaries can be downloaded from here. It can be called in Maple through
B2:=define_external(
        'B2',
        'a'::integer[4],
        'b'::integer[4],
        'RETURN'::integer[4],
        'LIB'="C:/MyProjects/Assembly/Binomial/Binomial.dll"
):
Now, compare the immediate calculation of
B2(1234567890,1011121314);

                                  0
with a long-long time taking calculation of
binomial(1234567890,1011121314) mod 2;
Warning, computation interrupted
in Maple.

Please Wait...