# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ64GA004 - Programmers Reference Manual

- 1
- 2
…
- 479
- 480
- 481
- 482
- 483
…
- 501
- 502

© 2005-2011 Microchip Technology Inc. DS70157F-page 481
Section 6. Built-in Functions
Built-in Functions
6
Example 6-2: Divide_32_by_16
#include <p33Fxxxx.h>
#include "divide.h"
_FOSCSEL(FNOSC_FRC);
_FOSC(FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_NONE);
_FWDT(FWDTEN_OFF);
unsigned int divide_(long a, int b) {
union convert {
unsigned long l;
unsigned int i[2];
} c;
int sign;
unsigned int result;
c.l = a;
sign = c.i[1] ^ b;
if (a < 0) a = (-a);
if (b < 0) b = -b;
result = __builtin_divud(a,b);
result >>= 1;
if (sign < 0) result = -result;
return result;
}
int main(void)
{
unsigned long dividend;
unsigned int divisor;
unsigned int quotient;
dividend = 0x3FFFFFFF;
divisor = 0x7FFF;
quotient = divide_((long)dividend, (int)divisor);
while(1);
}

- 1
- 2
…
- 479
- 480
- 481
- 482
- 483
…
- 501
- 502