⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.c

📁 jpeg and mpeg 编解码技术源代码
💻 C
字号:

#include "all.h"
#include "util.h"
#include <stdlib.h>


#define MAXINT	32767.

Float *NewFloat (int N) {
/* Allocate array of N Floats */

    Float *temp;

    temp = (Float *) malloc (N * sizeof (Float));
    if (!temp) {
		CommonExit(1,"2005: Memory allocation error");
		}
    return temp;
}

typedef Float *pFloat;

Float **NewFloatMatrix (int N, int M) {
/* Allocate NxM matrix of Floats */

    Float **temp;
    int i;

/* allocate N pointers to Float arrays */
    temp = (pFloat *) malloc (N * sizeof (pFloat));
    if (!temp) {
		CommonExit (1,"2006: Memory allocation error");
		}

/* Allocate a Float array M long for each of the N array pointers */

    for (i = 0; i < N; i++) {
		temp [i] = (Float *) malloc (M * sizeof (Float));
		if (! temp [i]) {
			CommonExit(1,"2007: Memory allocation error");
			}
		}
    return temp;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -