[fsbl] add fsbl for cv181x/cv180x
Change-Id: I6809bc5016d4bc148f62be2ed3f8e928ec111f19
This commit is contained in:
58
fsbl/lib/BigDigits/t_bdSimple.c
Normal file
58
fsbl/lib/BigDigits/t_bdSimple.c
Normal file
@ -0,0 +1,58 @@
|
||||
/* $Id: t_bdSimple.c $ */
|
||||
|
||||
/* A very simple test of some "bd" functions */
|
||||
|
||||
/***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* Copyright (c) 2001-15 David Ireland, D.I. Management Services Pty Limited
|
||||
* <http://www.di-mgt.com.au/bigdigits.html>. All rights reserved.
|
||||
*
|
||||
***** END LICENSE BLOCK *****/
|
||||
/*
|
||||
* Last updated:
|
||||
* $Date: 2015-10-22 10:23:00 $
|
||||
* $Revision: 2.5.0 $
|
||||
* $Author: dai $
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bigd.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
BIGD u, v, w;
|
||||
|
||||
/* Display the BigDigits version number */
|
||||
printf("BigDigits version=%d\n", bdVersion());
|
||||
|
||||
/* Create new BIGD objects */
|
||||
u = bdNew();
|
||||
v = bdNew();
|
||||
w = bdNew();
|
||||
|
||||
/* Compute 2 * 0xdeadbeefface */
|
||||
bdSetShort(u, 2);
|
||||
bdConvFromHex(v, "deadbeefface");
|
||||
bdMultiply(w, u, v);
|
||||
|
||||
/* Display the result */
|
||||
bdPrintHex("", u, " * ");
|
||||
bdPrintHex("0x", v, " = ");
|
||||
bdPrintHex("0x", w, "\n");
|
||||
/* and again in decimal format */
|
||||
bdPrintDecimal("", u, " * ");
|
||||
bdPrintDecimal("", v, " = ");
|
||||
bdPrintDecimal("", w, "\n");
|
||||
|
||||
/* Free all objects we made */
|
||||
bdFree(&u);
|
||||
bdFree(&v);
|
||||
bdFree(&w);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user