Paste number 158046: mpi test

Paste number 158046: mpi test
Pasted by: phf
When:3 years, 5 months ago
Share:Tweet this! | http://paste.lisp.org/+3DY6
Channel:None
Paste contents:
Raw Source | XML | Display As
#include <mpi.h>
#include <errors.h>
#include <stdlib.h>

void err(char *msg)
{
  fprintf(stderr, "%s\n", msg);
  exit(1);
}

void terpri(FILE *fp)
{
  fprintf(fp, "\n");
}

int main(int ac, char **av)
{
  MPI a, b, y;
  int r;
  
  r = secmem_init(1000);
  if (r==0) err("secmem init");

  a = mpi_alloc_secure(0);
  b = mpi_alloc_secure(0);
  y = mpi_alloc_secure(0);
  mpi_fromstr(a, "0x1B0B206C488601");
  mpi_fromstr(b, "0x20E92FE28E1929");
  mpi_mul(y, a, b);
  mpi_free(a);
  mpi_free(b);
  
  mpi_print(stdout, y, 1);
  mpi_free(y);
  
  terpri(stdout);
  secmem_term();
  
  return 0;
}

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.