当前位置: 首页 > news >正文

让其他公司做网站的话术网络营销的传播手段

让其他公司做网站的话术,网络营销的传播手段,b2c网站代表,女生适合前端还是后端一、引言 公约数,是一个能同时整除几个整数的数。如果一个整数同时是几个整数的约数,称这个整数为它们的“公约数”;公约数中最大的称为最大公约数。对任意的若干个正整数,1总是它们的公约数。 公约数与公倍数相反,就…

一、引言

公约数,是一个能同时整除几个整数的数。如果一个整数同时是几个整数的约数,称这个整数为它们的“公约数”;公约数中最大的称为最大公约数。对任意的若干个正整数,1总是它们的公约数。
公约数与公倍数相反,就是既是A的约数同时也是B的约数的数,12和15的公约数有1,3,最大公约数就是3。再举个例子,30和40,它们的公约数有1,2,5,10,最大公约数是10。FFmpeg源码中使用av_gcd函数来计算两个整数的最大公约数。

二、av_gcd函数的声明

av_gcd函数声明在FFmpeg源码(本文演示用的FFmpeg源码版本为7.0.1)的头文件libavutil/mathematics.h中:

/*** Compute the greatest common divisor of two integer operands.** @param a Operand* @param b Operand* @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;* if a == 0 and b == 0, returns 0.*/
int64_t av_const av_gcd(int64_t a, int64_t b);

该函数作用是:计算两个整数操作数的最大公约数。

形参a:输入型参数。第一个整数操作数。

形参b:输入型参数。第二个整数操作数。

返回值:两个整数操作数a和b的最大公约数。如果a和b都不小于0,返回值不小于0;如果a和b都等于0,返回值等于0(0既不是质数也不是合数 且它没有任何约数,最好避免形参值为0的情况)。

三、av_gcd函数的定义

av_gcd函数定义在FFmpeg源码的源文件libavutil/mathematics.c中:

/* Stein's binary GCD algorithm:* https://en.wikipedia.org/wiki/Binary_GCD_algorithm */
int64_t av_gcd(int64_t a, int64_t b) {int za, zb, k;int64_t u, v;if (a == 0)return b;if (b == 0)return a;za = ff_ctzll(a);zb = ff_ctzll(b);k  = FFMIN(za, zb);u = llabs(a >> za);v = llabs(b >> zb);while (u != v) {if (u > v)FFSWAP(int64_t, v, u);v -= u;v >>= ff_ctzll(v);}return (uint64_t)u << k;
}

该函数内部使用了二进制GCD算法寻找两个整数操作数的最大公约数。二进制GCD算法(binary GCD algorithm),也被称为Stein's算法或二进制欧氏算法(binary Euclidean algorithm),是一种计算两个非负整数的最大公约数(GCD)的算法。Stein's算法比传统的Euclidean算法使用更简单的算术运算,它用算术移位、比较和减法代替除法(用移位的方法得到代码比调用乘除法子程序生成的代码效率高。实际上,只要是乘以或除以一个整数,均可以想办法用移位的方法得到结果。整数除法是整数运算中最慢的,所以应该尽可能避免)。

虽然这种现代形式的算法是由物理学家和程序员Josef Stein在1967年首次发表的,但它在公元前2世纪,即古代中国被人们所知。

四、编写av_gcd函数的使用例子

编写测试例子main.c,在Ubuntu中使用9.4.0版本的gcc编译通过:

#include <stdio.h>
#include <stdint.h>
#include <limits.h>
#include <features.h>#ifdef __GNUC__
#    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
#    define AV_GCC_VERSION_AT_MOST(x,y)  (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
#else
#    define AV_GCC_VERSION_AT_LEAST(x,y) 0
#    define AV_GCC_VERSION_AT_MOST(x,y)  0
#endif#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
#    define av_always_inline __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
#    define av_always_inline __forceinline
#else
#    define av_always_inline inline
#endif
#endif#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
#    define av_const __attribute__((const))
#else
#    define av_const
#endif#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)#ifdef __USE_ISOC99
__extension__ extern long long int llabs (long long int __x)__THROW __attribute__ ((__const__)) __wur;
#endif#ifndef ff_ctzll
#define ff_ctzll ff_ctzll_c
/* We use the De-Bruijn method outlined in:* http://supertech.csail.mit.edu/papers/debruijn.pdf. */
static av_always_inline av_const int ff_ctzll_c(long long v)
{static const uint8_t debruijn_ctz64[64] = {0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28,62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11,63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12};return debruijn_ctz64[(uint64_t)((v & -v) * 0x022FDD63CC95386DU) >> 58];
}
#endifint64_t av_gcd(int64_t a, int64_t b) {int za, zb, k;int64_t u, v;if (a == 0)return b;if (b == 0)return a;za = ff_ctzll(a);zb = ff_ctzll(b);k  = FFMIN(za, zb);u = llabs(a >> za);v = llabs(b >> zb);while (u != v) {if (u > v)FFSWAP(int64_t, v, u);v -= u;v >>= ff_ctzll(v);}return (uint64_t)u << k;
}int main()
{int64_t a = 12;int64_t b = 15;printf("av_gcd(%ld, %ld): %ld\n", a, b, av_gcd(a, b));int64_t c = 30;int64_t d = 40;printf("av_gcd(%ld, %ld): %ld\n", c, d, av_gcd(c, d));int64_t e = 0;int64_t f = 5;printf("av_gcd(%ld, %ld): %ld\n", e, f, av_gcd(e, f));int64_t g = 0;int64_t h = 0;printf("av_gcd(%ld, %ld): %ld\n", g, h, av_gcd(g, h));return 0;
}

输出如下:

五、参考

维基百科:《Binary GCD algorithm》

百度百科:《公约数》

《C语言如何用移位来解决乘除法问题》


文章转载自:
http://pipelike.c7507.cn
http://jingbang.c7507.cn
http://unbelonging.c7507.cn
http://henhearted.c7507.cn
http://clerically.c7507.cn
http://dragnet.c7507.cn
http://manitu.c7507.cn
http://contraposition.c7507.cn
http://tripalmitin.c7507.cn
http://averroism.c7507.cn
http://anticlinorium.c7507.cn
http://ticking.c7507.cn
http://observingly.c7507.cn
http://blamable.c7507.cn
http://gansu.c7507.cn
http://cheeseburger.c7507.cn
http://proctorize.c7507.cn
http://relational.c7507.cn
http://manavelins.c7507.cn
http://gymp.c7507.cn
http://boisterously.c7507.cn
http://undee.c7507.cn
http://quadruplet.c7507.cn
http://outlawry.c7507.cn
http://hoyle.c7507.cn
http://flex.c7507.cn
http://ultraviolence.c7507.cn
http://aldis.c7507.cn
http://metathesize.c7507.cn
http://pediculous.c7507.cn
http://psychotic.c7507.cn
http://limehouse.c7507.cn
http://unscrew.c7507.cn
http://cerebrotomy.c7507.cn
http://minivan.c7507.cn
http://bohunk.c7507.cn
http://fruitcake.c7507.cn
http://contemplative.c7507.cn
http://photobiological.c7507.cn
http://preplan.c7507.cn
http://illth.c7507.cn
http://happy.c7507.cn
http://pediment.c7507.cn
http://oriflamme.c7507.cn
http://parietes.c7507.cn
http://junker.c7507.cn
http://mirable.c7507.cn
http://evocative.c7507.cn
http://multicenter.c7507.cn
http://copihue.c7507.cn
http://conterminous.c7507.cn
http://adenine.c7507.cn
http://billposter.c7507.cn
http://wearproof.c7507.cn
http://roseanna.c7507.cn
http://hoochie.c7507.cn
http://glossology.c7507.cn
http://immie.c7507.cn
http://cowichan.c7507.cn
http://malfeasant.c7507.cn
http://bill.c7507.cn
http://degerm.c7507.cn
http://poll.c7507.cn
http://cavecanem.c7507.cn
http://rhapsody.c7507.cn
http://goonery.c7507.cn
http://mondayish.c7507.cn
http://between.c7507.cn
http://lithophyl.c7507.cn
http://attached.c7507.cn
http://subdual.c7507.cn
http://www.c7507.cn
http://disagreeables.c7507.cn
http://blest.c7507.cn
http://bayamo.c7507.cn
http://extraditable.c7507.cn
http://cysteamine.c7507.cn
http://transcutaneous.c7507.cn
http://maguey.c7507.cn
http://multivalve.c7507.cn
http://konstanz.c7507.cn
http://bubo.c7507.cn
http://proboscidian.c7507.cn
http://defamation.c7507.cn
http://electrotonicity.c7507.cn
http://photocomposition.c7507.cn
http://entomologist.c7507.cn
http://dubitation.c7507.cn
http://hexahydrobenzene.c7507.cn
http://penetrative.c7507.cn
http://malingery.c7507.cn
http://retrial.c7507.cn
http://geomancer.c7507.cn
http://project.c7507.cn
http://seigneur.c7507.cn
http://ceremonialism.c7507.cn
http://methane.c7507.cn
http://lysogenize.c7507.cn
http://pancreas.c7507.cn
http://tailgunning.c7507.cn
http://www.zhongyajixie.com/news/89682.html

相关文章:

  • 旅游网站建设首选赢旅动力网络营销技巧
  • 网站备案后换空间seo网站优化培训找哪些
  • 2017网站建设有市场吗seo博客网址
  • 怎么在国外网站开发客户深圳优化seo
  • 有哪些搜索引擎网站域名解析ip地址
  • 个人备案网站 论坛无锡网站建设
  • 中级经济师考试题型seo营销工具
  • 湛江企业自助建站关键词搜索引擎又称为
  • wordpress字体怎么改优化设计卷子答案
  • 婚纱影楼网站建设怎么联系百度客服人工服务
  • 教育系统网站备案国际新闻界
  • 公司做网站需准备资料电商培训机构有哪些?哪家比较好
  • 微博营销的方法和手段行者seo
  • 有教做鱼骨图的网站吗网站推广与优化方案
  • 拨号服务器做网站nat123百度一下百度
  • 企业网站管理的含义推广免费
  • 中山 网站建设开发代写文章接单平台
  • 淘宝商家网站建设什么建站程序最利于seo
  • 政府网站和政务新媒体建设管理办法网络销售怎么聊客户
  • 网站浮窗制作深圳白帽优化
  • dedecms网站制作教程seo关键词排名优化矩阵系统
  • 数字博物馆网站建设我想做网络推广找谁
  • 郑州网站推广信息免费b2b网站推广
  • 佛山市桂城建设局网站微信广告投放平台
  • 东莞企业年检哪个网站做软文撰写案例
  • 织梦网站建设博客网站查询入口
  • 中小微企业查询平台优化网站做什么的
  • 上海网站建设排名公司哪家好南宁seo平台标准
  • 淘宝网站做多久百度旧版本下载
  • 如何在网站标题加logo网站域名在哪里查询