📄 t-asmtype.c
字号:
/* Test .type directives on assembler functions.Copyright 2001 Free Software Foundation, Inc.This file is part of the GNU MP Library.The GNU MP Library is free software; you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License as published bythe Free Software Foundation; either version 2.1 of the License, or (at youroption) any later version.The GNU MP Library is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General PublicLicense for more details.You should have received a copy of the GNU Lesser General Public Licensealong with the GNU MP Library; see the file COPYING.LIB. If not, write tothe Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,MA 02111-1307, USA.*/#include <stdio.h>#include <stdlib.h>#include "gmp.h"#include "gmp-impl.h"#include "tests.h"/* This apparently trivial test is designed to detect missing .type and .size directives in asm code, per the problem described under GMP_ASM_TYPE in acinclude.m4. A failure can be provoked in a shared or shared+static build by making TYPE and SIZE in config.m4 empty, either by editing it or by configuring with ./configure gmp_cv_asm_type= gmp_cv_asm_size= mpn_add_n is used for the test because normally it's implemented in assembler on a CPU that has any asm code. Enhancement: As noted with GMP_ASM_TYPE, if .type is wrong but .size is right then everything works, but uses code copied down to the mainline data area. Maybe we could detect that if we built a test library with an object that had .size deliberately disabled. */intmain (void){ static const mp_limb_t x[3] = { 1, 2, 3 }; static const mp_limb_t y[3] = { 4, 5, 6 }; static const mp_limb_t want[3] = { 5, 7, 9 }; mp_limb_t got[3]; mpn_add_n (got, x, y, (mp_size_t) 3); if (refmpn_cmp (got, want, (mp_size_t) 3) != 0) { printf ("Wrong result from mpn_add_n\n"); abort (); } exit (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -